/**
* @file rv30.c
- * RV30 decoder.
+ * RV30 decoder
*/
#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
+#include "golomb.h"
#include "rv34.h"
#include "rv30data.h"
}
/**
- * Decode 4x4 intra types array
+ * Decode 4x4 intra types array.
*/
-static int rv30_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int *dst)
+static int rv30_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t *dst)
{
int i, j, k;
for(i = 0; i < 4; i++, dst += r->s.b4_stride - 4){
for(j = 0; j < 4; j+= 2){
- int code = (ff_rv34_get_gamma(gb) - 1) << 1;
+ int code = svq3_get_ue_golomb(gb) << 1;
if(code >= 81*2){
av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction code\n");
return -1;
}
/**
- * Decode macroblock information
+ * Decode macroblock information.
*/
static int rv30_decode_mb_info(RV34DecContext *r)
{
static const int rv30_b_types[6] = { RV34_MB_SKIP, RV34_MB_B_DIRECT, RV34_MB_B_FORWARD, RV34_MB_B_BACKWARD, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };
MpegEncContext *s = &r->s;
GetBitContext *gb = &s->gb;
- int code = ff_rv34_get_gamma(gb) - 1;
+ int code = svq3_get_ue_golomb(gb);
if(code > 11){
av_log(s->avctx, AV_LOG_ERROR, "Incorrect MB type code\n");
av_log(s->avctx, AV_LOG_ERROR, "dquant needed\n");
code -= 6;
}
- if(s->pict_type != B_TYPE)
+ if(s->pict_type != FF_B_TYPE)
return rv30_p_types[code];
else
return rv30_b_types[code];
}
/**
- * Initialize decoder
+ * Initialize decoder.
*/
-static int rv30_decode_init(AVCodecContext *avctx)
+static av_cold int rv30_decode_init(AVCodecContext *avctx)
{
RV34DecContext *r = avctx->priv_data;
r->rv30 = 1;
ff_rv34_decode_init(avctx);
if(avctx->extradata_size < 2){
- av_log(avctx, AV_LOG_ERROR, "Extradata is too small\n");
+ av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n");
return -1;
}
r->rpr = (avctx->extradata[1] & 7) >> 1;
NULL,
ff_rv34_decode_end,
ff_rv34_decode_frame,
+ CODEC_CAP_DR1 | CODEC_CAP_DELAY,
};