[FFmpeg-devel] MXF D10 regression tests

Reimar Döffinger Reimar.Doeffinger
Tue Mar 17 10:20:36 CET 2009


On Tue, Mar 17, 2009 at 12:30:35AM +0100, Michael Niedermayer wrote:
> On Mon, Mar 16, 2009 at 09:07:40PM +0100, Reimar D?ffinger wrote:
> > On Mon, Mar 16, 2009 at 07:29:23PM +0100, Michael Niedermayer wrote:
> > > good so how does it look? i mean is there a vissible error when decoding
> > > is it limited to chroma? luma? right border? left border?
> > 
> > On which machine decoding is done seems irrelevant.
> > x86-encoded file looks fine, ppc64-encoded one has correct looking
> > luma but chroma (except possibly first slice or so) is messed up, see
> > http://natsuki.mplayerhq.hu/~reimar/00000001.png .
> 
> does changing STRIDE_ALIGN  affect this?

Yes, but the real issue is somewhere else, there is some stupid code in
mpegvideo_enc.c that assumes uvlinesize == linesize >> 1.
Attached patch fixes it.
It also fixes the MXF regression test, but either I messed up the test
or -f framecrc still differs (maybe due to the differing strides?)...
Concerning STRIDE_ALIGN: Why is it set to 16 for ARCH_PPC, that seems like
complete nonsense, shouldn't it depend on HAVE_ALTIVEC?
-------------- next part --------------
Index: libavcodec/mpegvideo_enc.c
===================================================================
--- libavcodec/mpegvideo_enc.c	(revision 18014)
+++ libavcodec/mpegvideo_enc.c	(working copy)
@@ -1441,6 +1441,7 @@
     int i;
     int skip_dct[8];
     int dct_offset   = s->linesize*8; //default for progressive frames
+    int uvdct_offset = s->uvlinesize*8;
     uint8_t *ptr_y, *ptr_cb, *ptr_cr;
     int wrap_y, wrap_c;
 
@@ -1507,6 +1508,7 @@
                     s->interlaced_dct=1;
 
                     dct_offset= wrap_y;
+                    uvdct_offset= wrap_c;
                     wrap_y<<=1;
                     if (s->chroma_format == CHROMA_422)
                         wrap_c<<=1;
@@ -1526,8 +1528,8 @@
             s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c);
             s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c);
             if(!s->chroma_y_shift){ /* 422 */
-                s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset>>1), wrap_c);
-                s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset>>1), wrap_c);
+                s->dsp.get_pixels(s->block[6], ptr_cb + uvdct_offset, wrap_c);
+                s->dsp.get_pixels(s->block[7], ptr_cr + uvdct_offset, wrap_c);
             }
         }
     }else{
@@ -1573,6 +1575,7 @@
                     s->interlaced_dct=1;
 
                     dct_offset= wrap_y;
+                    uvdct_offset= wrap_c;
                     wrap_y<<=1;
                     if (s->chroma_format == CHROMA_422)
                         wrap_c<<=1;
@@ -1592,8 +1595,8 @@
             s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c);
             s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c);
             if(!s->chroma_y_shift){ /* 422 */
-                s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset>>1), dest_cb + (dct_offset>>1), wrap_c);
-                s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset>>1), dest_cr + (dct_offset>>1), wrap_c);
+                s->dsp.diff_pixels(s->block[6], ptr_cb + uvdct_offset, dest_cb + uvdct_offset, wrap_c);
+                s->dsp.diff_pixels(s->block[7], ptr_cr + uvdct_offset, dest_cr + uvdct_offset, wrap_c);
             }
         }
         /* pre quantization */
@@ -1606,8 +1609,8 @@
             if(s->dsp.sad[1](NULL, ptr_cb              , dest_cb              , wrap_c, 8) < 20*s->qscale) skip_dct[4]= 1;
             if(s->dsp.sad[1](NULL, ptr_cr              , dest_cr              , wrap_c, 8) < 20*s->qscale) skip_dct[5]= 1;
             if(!s->chroma_y_shift){ /* 422 */
-                if(s->dsp.sad[1](NULL, ptr_cb +(dct_offset>>1), dest_cb +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[6]= 1;
-                if(s->dsp.sad[1](NULL, ptr_cr +(dct_offset>>1), dest_cr +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[7]= 1;
+                if(s->dsp.sad[1](NULL, ptr_cb +uvdct_offset, dest_cb +uvdct_offset, wrap_c, 8) < 20*s->qscale) skip_dct[6]= 1;
+                if(s->dsp.sad[1](NULL, ptr_cr +uvdct_offset, dest_cr +uvdct_offset, wrap_c, 8) < 20*s->qscale) skip_dct[7]= 1;
             }
         }
     }
@@ -1620,8 +1623,8 @@
         if(!skip_dct[4]) get_visual_weight(weight[4], ptr_cb                , wrap_c);
         if(!skip_dct[5]) get_visual_weight(weight[5], ptr_cr                , wrap_c);
         if(!s->chroma_y_shift){ /* 422 */
-            if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c);
-            if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c);
+            if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + uvdct_offset, wrap_c);
+            if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + uvdct_offset, wrap_c);
         }
         memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count);
     }



More information about the ffmpeg-devel mailing list