/*
* RV10 codec
- * Copyright (c) 2000,2001 Fabrice Bellard.
+ * Copyright (c) 2000,2001 Fabrice Bellard
* Copyright (c) 2002-2004 Michael Niedermayer
*
* This file is part of FFmpeg.
*/
/**
- * @file rv10.c
+ * @file libavcodec/rv10.c
* RV10 codec.
*/
}
-#if defined(CONFIG_RV10_ENCODER) || defined(CONFIG_RV20_ENCODER)
+#if CONFIG_RV10_ENCODER || CONFIG_RV20_ENCODER
/* write RV 1.0 compatible frame header */
void rv10_encode_picture_header(MpegEncContext *s, int picture_number)
{
/* specific MPEG like DC coding not used */
}
/* if multiple packets per frame are sent, the position at which
- to display the macro blocks is coded here */
+ to display the macroblocks is coded here */
if(!full_frame){
put_bits(&s->pb, 6, 0); /* mb_x */
put_bits(&s->pb, 6, 0); /* mb_y */
}
#endif
-#endif /* defined(CONFIG_RV10_ENCODER) || defined(CONFIG_RV20_ENCODER) */
+#endif /* CONFIG_RV10_ENCODER || CONFIG_RV20_ENCODER */
/* read RV 1.0 compatible frame header */
static int rv10_decode_picture_header(MpegEncContext *s)
}
}
/* if multiple packets per frame are sent, the position at which
- to display the macro blocks is coded here */
+ to display the macroblocks is coded here */
mb_xy= s->mb_x + s->mb_y*s->mb_width;
if(show_bits(&s->gb, 12)==0 || (mb_xy && mb_xy < s->mb_num)){
MpegEncContext *s = avctx->priv_data;
static int done=0;
+ if (avctx->extradata_size < 8) {
+ av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n");
+ return -1;
+ }
+
MPV_decode_defaults(s);
s->avctx= avctx;
if (avctx->sub_id == 0x10000000) {
s->rv10_version= 0;
s->low_delay=1;
+ } else if (avctx->sub_id == 0x10001000) {
+ s->rv10_version= 3;
+ s->low_delay=1;
} else if (avctx->sub_id == 0x10002000) {
s->rv10_version= 3;
s->low_delay=1;
/* init rv vlc */
if (!done) {
- init_vlc(&rv_dc_lum, DC_VLC_BITS, 256,
+ INIT_VLC_STATIC(&rv_dc_lum, DC_VLC_BITS, 256,
rv_lum_bits, 1, 1,
- rv_lum_code, 2, 2, 1);
- init_vlc(&rv_dc_chrom, DC_VLC_BITS, 256,
+ rv_lum_code, 2, 2, 16384);
+ INIT_VLC_STATIC(&rv_dc_chrom, DC_VLC_BITS, 256,
rv_chrom_bits, 1, 1,
- rv_chrom_code, 2, 2, 1);
+ rv_chrom_code, 2, 2, 16388);
done = 1;
}
static int rv10_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- const uint8_t *buf, int buf_size)
+ AVPacket *avpkt)
{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
MpegEncContext *s = avctx->priv_data;
int i;
AVFrame *pict = data;
rv10_decode_frame,
CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
+ .pix_fmts= ff_pixfmt_list_420,
};
AVCodec rv20_decoder = {
CODEC_CAP_DR1 | CODEC_CAP_DELAY,
.flush= ff_mpeg_flush,
.long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
+ .pix_fmts= ff_pixfmt_list_420,
};