diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-12-29 12:19:38 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-12-29 12:19:38 +0000 |
| commit | f7813a5324be39d13ab536c245d15dfc602a7849 (patch) | |
| tree | fad99148b88823d34a5df2f0a25881a002eb291b /ffmpeg/libavcodec/ituh263dec.c | |
| parent | b7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 (diff) | |
basic type mechanism working
Diffstat (limited to 'ffmpeg/libavcodec/ituh263dec.c')
| -rw-r--r-- | ffmpeg/libavcodec/ituh263dec.c | 44 |
1 files changed, 11 insertions, 33 deletions
diff --git a/ffmpeg/libavcodec/ituh263dec.c b/ffmpeg/libavcodec/ituh263dec.c index 5d604ef..71e36c1 100644 --- a/ffmpeg/libavcodec/ituh263dec.c +++ b/ffmpeg/libavcodec/ituh263dec.c @@ -28,10 +28,9 @@ */ #define UNCHECKED_BITSTREAM_READER 1 - -//#define DEBUG #include <limits.h> +#include "libavutil/attributes.h" #include "libavutil/internal.h" #include "libavutil/mathematics.h" #include "avcodec.h" @@ -100,7 +99,7 @@ static VLC cbpc_b_vlc; /* init vlcs */ /* XXX: find a better solution to handle static init */ -void ff_h263_decode_init_vlc(void) +av_cold void ff_h263_decode_init_vlc(void) { static volatile int done = 0; @@ -201,30 +200,6 @@ static int h263_decode_gob_header(MpegEncContext *s) } /** - * Find the next resync_marker. - * @param p pointer to buffer to scan - * @param end pointer to the end of the buffer - * @return pointer to the next resync_marker, or end if none was found - */ -const uint8_t *ff_h263_find_resync_marker(MpegEncContext *s, const uint8_t *av_restrict p, const uint8_t *av_restrict end) -{ - av_assert2(p < end); - - end-=2; - p++; - if(s->resync_marker){ - int prefix_len = ff_mpeg4_get_video_packet_prefix_length(s); - for(;p<end; p+=2){ - if(!*p){ - if (!p[-1] && ((p[1] >> (23-prefix_len)) == 1)) return p - 1; - else if (!p[ 1] && ((p[2] >> (23-prefix_len)) == 1)) return p; - } - } - } - return end+2; -} - -/** * Decode the group of blocks / video packet header. * @return bit position of the resync_marker, or <0 if none was found */ @@ -239,7 +214,7 @@ int ff_h263_resync(MpegEncContext *s){ if(show_bits(&s->gb, 16)==0){ pos= get_bits_count(&s->gb); if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4) - ret= ff_mpeg4_decode_video_packet_header(s); + ret= ff_mpeg4_decode_video_packet_header(s->avctx->priv_data); else ret= h263_decode_gob_header(s); if(ret>=0) @@ -256,7 +231,7 @@ int ff_h263_resync(MpegEncContext *s){ pos= get_bits_count(&s->gb); if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4) - ret= ff_mpeg4_decode_video_packet_header(s); + ret= ff_mpeg4_decode_video_packet_header(s->avctx->priv_data); else ret= h263_decode_gob_header(s); if(ret>=0) @@ -875,6 +850,10 @@ int ff_h263_decode_picture_header(MpegEncContext *s) align_get_bits(&s->gb); + if (show_bits(&s->gb, 2) == 2 && s->avctx->frame_number == 0) { + av_log(s->avctx, AV_LOG_WARNING, "Header looks like RTP instead of H.263\n"); + } + startcode= get_bits(&s->gb, 22-8); for(i= get_bits_left(&s->gb); i>24; i-=8) { @@ -892,7 +871,6 @@ int ff_h263_decode_picture_header(MpegEncContext *s) i = get_bits(&s->gb, 8); /* picture timestamp */ if( (s->picture_number&~0xFF)+i < s->picture_number) i+= 256; - s->current_picture_ptr->f.pts = s->picture_number= (s->picture_number&~0xFF) + i; /* PTYPE starts here */ @@ -1034,6 +1012,7 @@ int ff_h263_decode_picture_header(MpegEncContext *s) height = ff_h263_format[format][1]; s->avctx->sample_aspect_ratio= (AVRational){12,11}; } + s->avctx->sample_aspect_ratio.den <<= s->ehc_mode; if ((width == 0) || (height == 0)) return -1; s->width = width; @@ -1110,9 +1089,8 @@ int ff_h263_decode_picture_header(MpegEncContext *s) } /* PEI */ - while (get_bits1(&s->gb) != 0) { - skip_bits(&s->gb, 8); - } + if (skip_1stop_8data_bits(&s->gb) < 0) + return AVERROR_INVALIDDATA; if(s->h263_slice_structured){ if (get_bits1(&s->gb) != 1) { |
