[xiph-commits] r15950 - trunk/ffmpeg2theora/src
j at svn.xiph.org
j at svn.xiph.org
Fri Apr 24 02:29:48 PDT 2009
Author: j
Date: 2009-04-24 02:29:47 -0700 (Fri, 24 Apr 2009)
New Revision: 15950
Modified:
trunk/ffmpeg2theora/src/ffmpeg2theora.c
Log:
Scale YUV components to the full range 0-255, instead of 16-235 for Y and 16-240 for UV.
Modified: trunk/ffmpeg2theora/src/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/src/ffmpeg2theora.c 2009-04-23 16:39:09 UTC (rev 15949)
+++ trunk/ffmpeg2theora/src/ffmpeg2theora.c 2009-04-24 09:29:47 UTC (rev 15950)
@@ -277,6 +277,7 @@
}
static void prepare_yuv_buffer(ff2theora this, yuv_buffer *yuv, AVFrame *frame) {
+ int i;
/* pysical pages */
yuv->y_width = this->frame_width;
yuv->y_height = this->frame_height;
@@ -289,6 +290,15 @@
yuv->y = frame->data[0];
yuv->u = frame->data[1];
yuv->v = frame->data[2];
+
+ // Scale YUV components to the full range 0-255,
+ // instead of 16-235 for Y and 16-240 for UV.
+ for (i = 0; i < 256; i++) {
+ yuv->y[i] = (yuv->y[i] - 16) * 255 / 219;
+ yuv->u[i] = (yuv->u[i] - 128) * 255 / 224 + 128;
+ yuv->v[i] = (yuv->v[i] - 128) * 255 / 224 + 128;
+ }
+
if (this->y_lut_used) {
lut_apply(this->y_lut, yuv->y, yuv->y, yuv->y_width, yuv->y_height, yuv->y_stride);
}
More information about the commits
mailing list