#include <limits.h>
#include "libavutil/attributes.h"
+#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "avcodec.h"
#include "mpegvideo.h"
#include "h263.h"
+#include "h263data.h"
#include "internal.h"
#include "mathops.h"
#include "mpegutils.h"
#include "unary.h"
#include "flv.h"
+#include "rv10.h"
#include "mpeg4video.h"
+#include "mpegvideodata.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
INIT_VLC_STATIC(&mv_vlc, MV_VLC_BITS, 33,
&ff_mvtab[0][1], 2, 1,
&ff_mvtab[0][0], 2, 1, 538);
- ff_init_rl(&ff_h263_rl_inter, ff_h263_static_rl_table_store[0]);
- ff_init_rl(&ff_rl_intra_aic, ff_h263_static_rl_table_store[1]);
+ ff_rl_init(&ff_h263_rl_inter, ff_h263_static_rl_table_store[0]);
+ ff_rl_init(&ff_rl_intra_aic, ff_h263_static_rl_table_store[1]);
INIT_VLC_RL(ff_h263_rl_inter, 554);
INIT_VLC_RL(ff_rl_intra_aic, 554);
INIT_VLC_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15,
{
int i, mb_pos;
- for(i=0; i<6; i++){
- if(s->mb_num-1 <= ff_mba_max[i]) break;
- }
- mb_pos= get_bits(&s->gb, ff_mba_length[i]);
- s->mb_x= mb_pos % s->mb_width;
- s->mb_y= mb_pos / s->mb_width;
+ for (i = 0; i < 6; i++)
+ if (s->mb_num - 1 <= ff_mba_max[i])
+ break;
+ mb_pos = get_bits(&s->gb, ff_mba_length[i]);
+ s->mb_x = mb_pos % s->mb_width;
+ s->mb_y = mb_pos / s->mb_width;
return mb_pos;
}
/* most is hardcoded. should extend to handle all h263 streams */
int ff_h263_decode_picture_header(MpegEncContext *s)
{
- int format, width, height, i;
+ int format, width, height, i, ret;
uint32_t startcode;
align_get_bits(&s->gb);
/* H.263v1 */
width = ff_h263_format[format][0];
height = ff_h263_format[format][1];
- if (!width)
- return -1;
s->pict_type = AV_PICTURE_TYPE_I + get_bits1(&s->gb);
s->qscale = get_bits(&s->gb, 5);
}
+ if ((ret = av_image_check_size(s->width, s->height, 0, s)) < 0)
+ return ret;
+
s->mb_width = (s->width + 15) / 16;
s->mb_height = (s->height + 15) / 16;
s->mb_num = s->mb_width * s->mb_height;