[MPlayer-dev-eng] key frame extractor / vo_jpeg use YV12 instead of RGB patch

Trent Piepho xyzzy at speakeasy.org
Sat Mar 17 21:03:51 CET 2007


On Sat, 17 Mar 2007, Michael Niedermayer wrote:
> On Fri, Mar 16, 2007 at 05:03:23PM -0700, Trent Piepho wrote:
> > Chroma is scaled too.  swscaler has some support for JPEG range YUV data,
> > if you look at the code you can see stubs for it.  I don't think it totally
> > works.
>
> swscaler itself supports it, mplayer and mencoder dont, problem is they
> dont distinguish full range from non full range yuv

I was thinking of this function in swscaler.c:
/**
 * @param inv_table the yuv2rgb coeffs, normally Inverse_Table_6_9[x]
 * @param fullRange if 1 then the luma range is 0..255 if 0 its 16..235
 * @return -1 if not supported
 */
int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation){

The comment is wrong, there is no 'fullRange' param, it's really srcRange
and dstRange.  Anyway, srcRange is used to scale luma:
        if(!srcRange){
                cy= (cy*255) / 219;
                oy= 16<<16;
        }
dstRange is never used.  So I think one can convert from full-range luma to
rgb with swscaler (if mplayer allowed one to set the format to
PIX_FMT_J420P), but not the other way around.  No RGB to full-range YUV.

I also don't see where 601 range YUV to full-range YUV would be done.  It
doesn't seem like there is any general YUV->YUV conversion.

I don't think these ranges are correct either.  Only Y is being scaled to
0..255, U and V are not changed.  From the libjpeg source:

 * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
 * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.

I'm pretty sure that U and V are supposed to have the range 0..255.



More information about the MPlayer-dev-eng mailing list