On Thu, 2011-05-12 at 18:09 +0400, Dmitriy K wrote:
> Is there any examples of this conversion? > I've found YUV_TO_RGB1 and YUV_TO_RGB2 in libavcodec/colorspace.h in > documentation, but there is no this file in my system. > _______________________________________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user here's a snippet from our code that does the conversion. Note how we clamp the range from 0 to 255. Sorry about the integer math. Also be careful as I'm not positive we're RGB...I have this vague recollection that the next step in our process expects BGRA data. Your mileage may vary.... res = ((Y * 1000) + (1574 * Pr)) / 1000; if ( res > 255 ) res = 255; if ( res < 0 ) res = 0; *(bufptr+(i*4)) = res; res = ((Y * 1000) - (187 * Pb) - (468 * Pr)) / 1000; if ( res > 255 ) res = 255; if ( res < 0 ) res = 0; *(bufptr+(i*4)+1) = res; res = ((Y * 1000) + (1855 * Pb)) / 1000; if ( res > 255 ) res = 255; if ( res < 0 ) res = 0; *(bufptr+(i*4)+2) = res;
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
