changeset 2380:3daf36fd1999 libavcodec

rv20 encoding
author michael
date Tue, 07 Dec 2004 13:14:37 +0000
parents a9aae760463e
children cfc9e0489859
files allcodecs.c mpegvideo.c mpegvideo.h rv10.c
diffstat 4 files changed, 56 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/allcodecs.c	Mon Dec 06 22:44:03 2004 +0000
+++ b/allcodecs.c	Tue Dec 07 13:14:37 2004 +0000
@@ -64,6 +64,7 @@
     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);
--- a/mpegvideo.c	Mon Dec 06 22:44:03 2004 +0000
+++ b/mpegvideo.c	Tue Dec 07 13:14:37 2004 +0000
@@ -1120,6 +1120,16 @@
         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 @@
     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 @@
     }
     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 @@
             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 @@
     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,
--- a/mpegvideo.h	Mon Dec 06 22:44:03 2004 +0000
+++ b/mpegvideo.h	Tue Dec 07 13:14:37 2004 +0000
@@ -932,6 +932,7 @@
 /* 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 */
--- a/rv10.c	Mon Dec 06 22:44:03 2004 +0000
+++ b/rv10.c	Tue Dec 07 13:14:37 2004 +0000
@@ -258,6 +258,35 @@
     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;