Mercurial > libavcodec.hg
annotate flvdec.c @ 11969:3cd4cd0509cd libavcodec
Remove PPC perf counter support
This functionality is better accessed through tools like oprofile.
| author | mru |
|---|---|
| date | Sat, 26 Jun 2010 22:23:35 +0000 |
| parents | 8a4984c5cacc |
| children | c35d7bc64882 |
| rev | line source |
|---|---|
| 10788 | 1 /* |
| 2 * FLV decoding. | |
| 3 * This file is part of FFmpeg. | |
| 4 * | |
| 5 * FFmpeg is free software; you can redistribute it and/or | |
| 6 * modify it under the terms of the GNU Lesser General Public | |
| 7 * License as published by the Free Software Foundation; either | |
| 8 * version 2.1 of the License, or (at your option) any later version. | |
| 9 * | |
| 10 * FFmpeg is distributed in the hope that it will be useful, | |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 * Lesser General Public License for more details. | |
| 14 * | |
| 15 * You should have received a copy of the GNU Lesser General Public | |
| 16 * License along with FFmpeg; if not, write to the Free Software | |
| 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 18 */ | |
| 19 | |
| 20 #include "mpegvideo.h" | |
| 10828 | 21 #include "h263.h" |
| 10790 | 22 #include "flv.h" |
| 10788 | 23 |
| 24 void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last){ | |
| 25 int is11 = get_bits1(gb); | |
| 26 *last = get_bits1(gb); | |
| 27 *run = get_bits(gb, 6); | |
| 28 if(is11){ | |
| 29 *level = get_sbits(gb, 11); | |
| 30 } else { | |
| 31 *level = get_sbits(gb, 7); | |
| 32 } | |
| 33 } | |
| 34 | |
| 35 int ff_flv_decode_picture_header(MpegEncContext *s) | |
| 36 { | |
| 37 int format, width, height; | |
| 38 | |
| 39 /* picture header */ | |
| 40 if (get_bits_long(&s->gb, 17) != 1) { | |
| 41 av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n"); | |
| 42 return -1; | |
| 43 } | |
| 44 format = get_bits(&s->gb, 5); | |
| 45 if (format != 0 && format != 1) { | |
| 46 av_log(s->avctx, AV_LOG_ERROR, "Bad picture format\n"); | |
| 47 return -1; | |
| 48 } | |
| 49 s->h263_flv = format+1; | |
| 50 s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */ | |
| 51 format = get_bits(&s->gb, 3); | |
| 52 switch (format) { | |
| 53 case 0: | |
| 54 width = get_bits(&s->gb, 8); | |
| 55 height = get_bits(&s->gb, 8); | |
| 56 break; | |
| 57 case 1: | |
| 58 width = get_bits(&s->gb, 16); | |
| 59 height = get_bits(&s->gb, 16); | |
| 60 break; | |
| 61 case 2: | |
| 62 width = 352; | |
| 63 height = 288; | |
| 64 break; | |
| 65 case 3: | |
| 66 width = 176; | |
| 67 height = 144; | |
| 68 break; | |
| 69 case 4: | |
| 70 width = 128; | |
| 71 height = 96; | |
| 72 break; | |
| 73 case 5: | |
| 74 width = 320; | |
| 75 height = 240; | |
| 76 break; | |
| 77 case 6: | |
| 78 width = 160; | |
| 79 height = 120; | |
| 80 break; | |
| 81 default: | |
| 82 width = height = 0; | |
| 83 break; | |
| 84 } | |
| 85 if(avcodec_check_dimensions(s->avctx, width, height)) | |
| 86 return -1; | |
| 87 s->width = width; | |
| 88 s->height = height; | |
| 89 | |
| 90 s->pict_type = FF_I_TYPE + get_bits(&s->gb, 2); | |
| 91 s->dropable= s->pict_type > FF_P_TYPE; | |
| 92 if (s->dropable) | |
| 93 s->pict_type = FF_P_TYPE; | |
| 94 | |
| 95 skip_bits1(&s->gb); /* deblocking flag */ | |
| 96 s->chroma_qscale= s->qscale = get_bits(&s->gb, 5); | |
| 97 | |
| 98 s->h263_plus = 0; | |
| 99 | |
| 100 s->unrestricted_mv = 1; | |
| 101 s->h263_long_vectors = 0; | |
| 102 | |
| 103 /* PEI */ | |
| 104 while (get_bits1(&s->gb) != 0) { | |
| 105 skip_bits(&s->gb, 8); | |
| 106 } | |
| 107 s->f_code = 1; | |
| 108 | |
| 109 if(s->avctx->debug & FF_DEBUG_PICT_INFO){ | |
| 110 av_log(s->avctx, AV_LOG_DEBUG, "%c esc_type:%d, qp:%d num:%d\n", | |
| 111 s->dropable ? 'D' : av_get_pict_type_char(s->pict_type), s->h263_flv-1, s->qscale, s->picture_number); | |
| 112 } | |
| 113 | |
| 114 s->y_dc_scale_table= | |
| 115 s->c_dc_scale_table= ff_mpeg1_dc_scale_table; | |
| 116 | |
| 117 return 0; | |
| 118 } | |
| 119 | |
| 120 AVCodec flv_decoder = { | |
| 121 "flv", | |
|
11560
8a4984c5cacc
Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents:
10828
diff
changeset
|
122 AVMEDIA_TYPE_VIDEO, |
| 10788 | 123 CODEC_ID_FLV1, |
| 124 sizeof(MpegEncContext), | |
| 125 ff_h263_decode_init, | |
| 126 NULL, | |
| 127 ff_h263_decode_end, | |
| 128 ff_h263_decode_frame, | |
| 129 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | |
| 130 .long_name= NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"), | |
| 131 .pix_fmts= ff_pixfmt_list_420, | |
| 132 }; |
