#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
+#include "golomb.h"
#include "rv34.h"
#include "rv40vlc2.h"
/**
* Initialize all tables.
*/
-static void rv40_init_tables()
+static av_cold void rv40_init_tables()
{
int i;
static int rv40_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceInfo *si)
{
- int t, mb_bits;
+ int mb_bits;
int w = r->s.width, h = r->s.height;
int mb_size;
return -1;
si->vlc_set = get_bits(gb, 2);
skip_bits1(gb);
- t = get_bits(gb, 13); /// ???
+ si->pts = get_bits(gb, 13);
if(!si->type || !get_bits1(gb))
rv40_parse_picture_size(gb, &w, &h);
+ if(avcodec_check_dimensions(r->s.avctx, w, h) < 0)
+ return -1;
si->width = w;
si->height = h;
mb_size = ((w + 15) >> 4) * ((h + 15) >> 4);
/**
* Decode 4x4 intra types array.
*/
-static int rv40_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int *dst)
+static int rv40_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t *dst)
{
MpegEncContext *s = &r->s;
int i, j, k, v;
int A, B, C;
int pattern;
- int *ptr;
+ int8_t *ptr;
for(i = 0; i < 4; i++, dst += s->b4_stride){
if(!i && s->first_slice_line){
int count = 0;
if(!r->s.mb_skip_run)
- r->s.mb_skip_run = ff_rv34_get_gamma(gb);
+ r->s.mb_skip_run = svq3_get_ue_golomb(gb) + 1;
if(--r->s.mb_skip_run)
return RV34_MB_SKIP;
- if(r->avail[0])
+ if(r->avail_cache[5-1])
blocks[r->mb_type[mb_pos - 1]]++;
- if(r->avail[1]){
+ if(r->avail_cache[5-4]){
blocks[r->mb_type[mb_pos - s->mb_stride]]++;
- if(r->avail[2])
+ if(r->avail_cache[5-2])
blocks[r->mb_type[mb_pos - s->mb_stride + 1]]++;
- if(r->avail[3])
+ if(r->avail_cache[5-5])
blocks[r->mb_type[mb_pos - s->mb_stride - 1]]++;
}
prev_type = i;
}
}
- if(s->pict_type == P_TYPE){
+ if(s->pict_type == FF_P_TYPE){
prev_type = block_num_to_ptype_vlc_num[prev_type];
q = get_vlc2(gb, ptype_vlc[prev_type].table, PTYPE_VLC_BITS, 1);
if(q < PBTYPE_ESCAPE)
/**
* Initialize decoder.
*/
-static int rv40_decode_init(AVCodecContext *avctx)
+static av_cold int rv40_decode_init(AVCodecContext *avctx)
{
RV34DecContext *r = avctx->priv_data;
NULL,
ff_rv34_decode_end,
ff_rv34_decode_frame,
+ CODEC_CAP_DR1 | CODEC_CAP_DELAY,
+ .long_name = NULL_IF_CONFIG_SMALL("RealVideo 4.0"),
};