changeset 1098:b7f267d168b7 libavcodec

mpeg2 field pictures + sliced mode (doesnt work with mplayer though, dunno why)
author michaelni
date Wed, 05 Mar 2003 20:03:15 +0000
parents 7104c8561512
children 988b180afd31
files h263dec.c mpeg12.c mpegvideo.c mpegvideo.h
diffstat 4 files changed, 20 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/h263dec.c	Wed Mar 05 17:53:33 2003 +0000
+++ b/h263dec.c	Wed Mar 05 20:03:15 2003 +0000
@@ -213,7 +213,7 @@
                         
                     if(++s->mb_x >= s->mb_width){
                         s->mb_x=0;
-                        ff_draw_horiz_band(s);
+                        ff_draw_horiz_band(s, s->mb_y*16, 16);
                         s->mb_y++;
                     }
                     return 0; 
@@ -230,7 +230,7 @@
             }
         }
         
-        ff_draw_horiz_band(s);
+        ff_draw_horiz_band(s, s->mb_y*16, 16);
         
         s->mb_x= 0;
     }
--- a/mpeg12.c	Wed Mar 05 17:53:33 2003 +0000
+++ b/mpeg12.c	Wed Mar 05 20:03:15 2003 +0000
@@ -1875,7 +1875,13 @@
         }
 
         if (++s->mb_x >= s->mb_width) {
-            ff_draw_horiz_band(s);
+            if(s->picture_structure==PICT_FRAME){
+                ff_draw_horiz_band(s, 16*s->mb_y, 16);
+            }else{
+                if(!s->first_field){
+                    ff_draw_horiz_band(s, 32*s->mb_y, 32);
+                }
+            }
 
             s->mb_x = 0;
             s->mb_y++;
--- a/mpegvideo.c	Wed Mar 05 17:53:33 2003 +0000
+++ b/mpegvideo.c	Wed Mar 05 20:03:15 2003 +0000
@@ -2051,7 +2051,7 @@
         }else
             s->mb_skiped= 0;
 
-        if(s->pict_type==B_TYPE && s->avctx->draw_horiz_band){
+        if(s->pict_type==B_TYPE && s->avctx->draw_horiz_band && s->picture_structure==PICT_FRAME){ //FIXME precalc
             dest_y  = s->current_picture.data[0] + mb_x * 16;
             dest_cb = s->current_picture.data[1] + mb_x * 8;
             dest_cr = s->current_picture.data[2] + mb_x * 8;
@@ -2356,17 +2356,18 @@
 
 #endif //CONFIG_ENCODERS
 
-void ff_draw_horiz_band(MpegEncContext *s){
+/**
+ *
+ * @param h is the normal height, this will be reduced automatically if needed for the last row
+ */
+void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
     if (    s->avctx->draw_horiz_band 
         && (s->last_picture.data[0] || s->low_delay) ) {
         uint8_t *src_ptr[3];
-        int y, h, offset;
-        y = s->mb_y * 16;
-        h = s->height - y;
-        if (h > 16)
-            h = 16;
-
-        if(s->pict_type==B_TYPE)
+        int offset;
+        h= FFMIN(h, s->height - y);
+
+        if(s->pict_type==B_TYPE && s->picture_structure == PICT_FRAME)
             offset = 0;
         else
             offset = y * s->linesize;
--- a/mpegvideo.h	Wed Mar 05 17:53:33 2003 +0000
+++ b/mpegvideo.h	Wed Mar 05 20:03:15 2003 +0000
@@ -593,7 +593,7 @@
 void ff_clean_intra_table_entries(MpegEncContext *s);
 void ff_init_scantable(MpegEncContext *s, ScanTable *st, const uint8_t *src_scantable);
 void ff_error_resilience(MpegEncContext *s);
-void ff_draw_horiz_band(MpegEncContext *s);
+void ff_draw_horiz_band(MpegEncContext *s, int y, int h);
 void ff_emulated_edge_mc(MpegEncContext *s, uint8_t *src, int linesize, int block_w, int block_h, 
                                     int src_x, int src_y, int w, int h);
 char ff_get_pict_type_char(int pict_type);