* h263 decoder.
*/
-//#define DEBUG
#include <limits.h>
+#include "libavutil/attributes.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "avcodec.h"
#include "mpegvideo.h"
#include "h263.h"
#include "mathops.h"
+#include "mpegutils.h"
#include "unary.h"
#include "flv.h"
#include "mpeg4video.h"
-//#undef NDEBUG
-//#include <assert.h>
-
// The defines below define the number of bits that are read at once for
// reading vlc values. Changing these may improve speed and data cache needs
// be aware though that decreasing them may need the number of stages that is
/* 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 int done = 0;
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)
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)
}
if(IS_DIRECT(mb_type)){
+ if (!s->pp_time)
+ return AVERROR_INVALIDDATA;
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
mb_type |= ff_mpeg4_set_direct_mv(s, 0, 0);
}else{
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 */