[Mplayer-advusers] ffmjpeg DR? bug FIX

rsnel at cube.dyndns.org rsnel at cube.dyndns.org
Thu Nov 6 20:04:46 CET 2003


Hello Michael,

On Tue, Nov 04, 2003 at 11:39:19PM +0100, Michael Niedermayer wrote:
> On Tuesday 04 November 2003 22:18, rsnel at cube.dyndns.org wrote:
> > My guess is that it has someting to do with the colorspace
> > of the JPEGS inside. (YUV422, instead of the more common YUV420).
> hmm the chroma stride returned by mpcodecs_get_image() suddenly
> doubles before the crash, so this doesnt seem to be a libavcodec bug,
> and no, the stride doublng code at line 730 in vd_ffmpeg isnt it, as
> it happens with that commented out too

I found the problem, it is in postproc/. If the colorspace converter
encounters YUV422, it doubles the strides and treats the data as YUV420.
But it doesn't reset the strides to the correct values... (and the mpi's
are re-used without re-initializing the stride parameters).

Proposed fix:

restore the old values of stride at the end of the colorspace
conversion. (note, I grepped in postproc/yuv* for IMGFMT_422P and 
therefore I should have found all occurances).

Patch attached. (If you agree with the fix, I can also apply it myself)

Greetings,

Rik.

-- 
Nothing is ever a total loss; it can always serve as a bad example.
-------------- next part --------------
Index: yuv2rgb.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/yuv2rgb.c,v
retrieving revision 1.21
diff -u -r1.21 yuv2rgb.c
--- yuv2rgb.c	1 May 2003 19:14:27 -0000	1.21
+++ yuv2rgb.c	6 Nov 2003 18:49:01 -0000
@@ -289,6 +289,10 @@
 	    dst_2 += dst_delta;\
 	}\
     }\
+    if(c->srcFormat == IMGFMT_422P){\
+	srcStride[1] /= 2;\
+	srcStride[2] /= 2;\
+    }\
     return srcSliceH;\
 }
 
Index: yuv2rgb_mlib.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/yuv2rgb_mlib.c,v
retrieving revision 1.8
diff -u -r1.8 yuv2rgb_mlib.c
--- yuv2rgb_mlib.c	7 Oct 2003 22:41:56 -0000	1.8
+++ yuv2rgb_mlib.c	6 Nov 2003 18:49:01 -0000
@@ -44,6 +44,10 @@
  
     mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
 			     srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
+    if(c->srcFormat == IMGFMT_422P){
+	srcStride[1] /= 2;
+	srcStride[2] /= 2;
+    }
     return srcSliceH;
 }
 
@@ -58,6 +62,10 @@
  
     mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
 			     srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
+    if(c->srcFormat == IMGFMT_422P){
+	srcStride[1] /= 2;
+	srcStride[2] /= 2;
+    }
     return srcSliceH;
 }
 
@@ -72,6 +80,10 @@
  
     mlib_VideoColorYUV2RGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
 			     srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
+    if(c->srcFormat == IMGFMT_422P){
+	srcStride[1] /= 2;
+	srcStride[2] /= 2;
+    }
     return srcSliceH;
 }
 
Index: yuv2rgb_template.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/yuv2rgb_template.c,v
retrieving revision 1.15
diff -u -r1.15 yuv2rgb_template.c
--- yuv2rgb_template.c	24 Feb 2003 00:12:30 -0000	1.15
+++ yuv2rgb_template.c	6 Nov 2003 18:49:01 -0000
@@ -215,6 +215,12 @@
 
     __asm__ __volatile__ (EMMS);
     
+
+    if(c->srcFormat == IMGFMT_422P){
+	srcStride[1] /= 2;
+	srcStride[2] /= 2;
+    }
+
     return srcSliceH;
 }
 
@@ -304,6 +310,12 @@
     }
 
     __asm__ __volatile__ (EMMS);
+
+    if(c->srcFormat == IMGFMT_422P){
+	srcStride[1] /= 2;
+	srcStride[2] /= 2;
+    }
+
     return srcSliceH;
 }
 
@@ -450,6 +462,12 @@
     }
 
     __asm__ __volatile__ (EMMS);
+
+    if(c->srcFormat == IMGFMT_422P){
+	srcStride[1] /= 2;
+	srcStride[2] /= 2;
+    }
+
     return srcSliceH;
 }
 
@@ -536,5 +554,11 @@
     }
 
     __asm__ __volatile__ (EMMS);
+
+    if(c->srcFormat == IMGFMT_422P){
+	srcStride[1] /= 2;
+	srcStride[2] /= 2;
+    }
+
     return srcSliceH;
 }


More information about the MPlayer-advusers mailing list