mirror of https://git.ffmpeg.org/ffmpeg.git
rv20 encoding
Originally committed as revision 3739 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
37e85dacd0
commit
d0271e8a3a
|
@ -64,6 +64,7 @@ void avcodec_register_all(void)
|
|||
register_avcodec(&h263p_encoder);
|
||||
register_avcodec(&flv_encoder);
|
||||
register_avcodec(&rv10_encoder);
|
||||
register_avcodec(&rv20_encoder);
|
||||
register_avcodec(&mpeg4_encoder);
|
||||
register_avcodec(&msmpeg4v1_encoder);
|
||||
register_avcodec(&msmpeg4v2_encoder);
|
||||
|
|
|
@ -1120,6 +1120,16 @@ int MPV_encode_init(AVCodecContext *avctx)
|
|||
avctx->delay=0;
|
||||
s->low_delay=1;
|
||||
break;
|
||||
case CODEC_ID_RV20:
|
||||
s->out_format = FMT_H263;
|
||||
avctx->delay=0;
|
||||
s->low_delay=1;
|
||||
s->modified_quant=1;
|
||||
s->h263_aic=1;
|
||||
s->h263_plus=1;
|
||||
s->loop_filter=1;
|
||||
s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus;
|
||||
break;
|
||||
case CODEC_ID_MPEG4:
|
||||
s->out_format = FMT_H263;
|
||||
s->h263_pred = 1;
|
||||
|
@ -4150,6 +4160,7 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
|
|||
case CODEC_ID_H263P:
|
||||
case CODEC_ID_FLV1:
|
||||
case CODEC_ID_RV10:
|
||||
case CODEC_ID_RV20:
|
||||
h263_encode_mb(s, s->block, motion_x, motion_y); break;
|
||||
#endif
|
||||
case CODEC_ID_MJPEG:
|
||||
|
@ -4175,6 +4186,8 @@ void ff_mpeg_flush(AVCodecContext *avctx){
|
|||
}
|
||||
s->current_picture_ptr = s->last_picture_ptr = s->next_picture_ptr = NULL;
|
||||
|
||||
s->mb_x= s->mb_y= 0;
|
||||
|
||||
s->parse_context.state= -1;
|
||||
s->parse_context.frame_start_found= 0;
|
||||
s->parse_context.overread= 0;
|
||||
|
@ -5255,6 +5268,8 @@ static void encode_picture(MpegEncContext *s, int picture_number)
|
|||
mpeg4_encode_picture_header(s, picture_number);
|
||||
else if (s->codec_id == CODEC_ID_RV10)
|
||||
rv10_encode_picture_header(s, picture_number);
|
||||
else if (s->codec_id == CODEC_ID_RV20)
|
||||
rv20_encode_picture_header(s, picture_number);
|
||||
else if (s->codec_id == CODEC_ID_FLV1)
|
||||
ff_flv_encode_picture_header(s, picture_number);
|
||||
else
|
||||
|
@ -6379,6 +6394,16 @@ AVCodec rv10_encoder = {
|
|||
MPV_encode_end,
|
||||
};
|
||||
|
||||
AVCodec rv20_encoder = {
|
||||
"rv20",
|
||||
CODEC_TYPE_VIDEO,
|
||||
CODEC_ID_RV20,
|
||||
sizeof(MpegEncContext),
|
||||
MPV_encode_init,
|
||||
MPV_encode_picture,
|
||||
MPV_encode_end,
|
||||
};
|
||||
|
||||
AVCodec mpeg4_encoder = {
|
||||
"mpeg4",
|
||||
CODEC_TYPE_VIDEO,
|
||||
|
|
|
@ -932,6 +932,7 @@ int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size);
|
|||
/* rv10.c */
|
||||
void rv10_encode_picture_header(MpegEncContext *s, int picture_number);
|
||||
int rv_decode_dc(MpegEncContext *s, int n);
|
||||
void rv20_encode_picture_header(MpegEncContext *s, int picture_number);
|
||||
|
||||
|
||||
/* msmpeg4.c */
|
||||
|
|
|
@ -258,6 +258,35 @@ void rv10_encode_picture_header(MpegEncContext *s, int picture_number)
|
|||
put_bits(&s->pb, 3, 0); /* ignored */
|
||||
}
|
||||
|
||||
void rv20_encode_picture_header(MpegEncContext *s, int picture_number){
|
||||
put_bits(&s->pb, 2, s->pict_type); //I 0 vs. 1 ?
|
||||
put_bits(&s->pb, 1, 0); /* unknown bit */
|
||||
put_bits(&s->pb, 5, s->qscale);
|
||||
|
||||
put_bits(&s->pb, 8, picture_number&0xFF); //FIXME wrong, but correct is not known
|
||||
s->mb_x= s->mb_y= 0;
|
||||
ff_h263_encode_mba(s);
|
||||
|
||||
put_bits(&s->pb, 1, s->no_rounding);
|
||||
|
||||
assert(s->f_code == 1);
|
||||
assert(s->unrestricted_mv == 1);
|
||||
// assert(s->h263_aic== (s->pict_type == I_TYPE));
|
||||
assert(s->alt_inter_vlc == 0);
|
||||
assert(s->umvplus == 0);
|
||||
assert(s->modified_quant==1);
|
||||
assert(s->loop_filter==1);
|
||||
|
||||
s->h263_aic= s->pict_type == I_TYPE;
|
||||
if(s->h263_aic){
|
||||
s->y_dc_scale_table=
|
||||
s->c_dc_scale_table= ff_aic_dc_scale_table;
|
||||
}else{
|
||||
s->y_dc_scale_table=
|
||||
s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
|
||||
}
|
||||
}
|
||||
|
||||
static int get_num(GetBitContext *gb)
|
||||
{
|
||||
int n, n1;
|
||||
|
|
|
@ -230,7 +230,10 @@ static void rv10_write_header(AVFormatContext *ctx,
|
|||
} else {
|
||||
/* video codec info */
|
||||
put_be32(s,34); /* size */
|
||||
put_tag(s,"VIDORV10");
|
||||
if(stream->enc->codec_id == CODEC_ID_RV10)
|
||||
put_tag(s,"VIDORV10");
|
||||
else
|
||||
put_tag(s,"VIDORV20");
|
||||
put_be16(s, stream->enc->width);
|
||||
put_be16(s, stream->enc->height);
|
||||
put_be16(s, (int) stream->frame_rate); /* frames per seconds ? */
|
||||
|
@ -241,7 +244,10 @@ static void rv10_write_header(AVFormatContext *ctx,
|
|||
/* Seems to be the codec version: only use basic H263. The next
|
||||
versions seems to add a diffential DC coding as in
|
||||
MPEG... nothing new under the sun */
|
||||
put_be32(s,0x10000000);
|
||||
if(stream->enc->codec_id == CODEC_ID_RV10)
|
||||
put_be32(s,0x10000000);
|
||||
else
|
||||
put_be32(s,0x20103001);
|
||||
//put_be32(s,0x10003000);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue