summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2004-07-11 21:38:05 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2004-07-11 21:38:05 +0000
commitbe3a541c64eaff129a1d6a70b4241aab34187d14 (patch)
tree3d713a405a736cc56a1aa4e8bf83cd3ce169ae5d
parentd2d3a03835c3f1fbfd414d8626af2291680be85c (diff)
downloadxine-lib-be3a541c64eaff129a1d6a70b4241aab34187d14.tar.gz
xine-lib-be3a541c64eaff129a1d6a70b4241aab34187d14.tar.bz2
PNGs are rendered too bright because the conversion coefficients are wrong
CVS patchset: 6789 CVS date: 2004/07/11 21:38:05
-rw-r--r--src/libxinevdec/image.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libxinevdec/image.c b/src/libxinevdec/image.c
index 72c2e7366..d82b1f194 100644
--- a/src/libxinevdec/image.c
+++ b/src/libxinevdec/image.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: image.c,v 1.14 2004/01/12 17:35:18 miguelfreitas Exp $
+ * $Id: image.c,v 1.15 2004/07/11 21:38:05 mroi Exp $
*
* a image video decoder
*/
@@ -208,6 +208,7 @@ static void row_callback(png_structp png_ptr, png_bytep new_row,
#define FIX(x) ( (int32_t) ( (x) * (1<<SCALEBITS) + 0.5 ) )
#define ONE_HALF ( (int32_t) (1<< (SCALEBITS-1)) )
#define CBCR_OFFSET (CENTERSAMPLE << SCALEBITS)
+#define FOOTROOM (16 << SCALEBITS)
static void end_callback(png_structp png_ptr, png_infop info) {
@@ -246,16 +247,16 @@ static void end_callback(png_structp png_ptr, png_infop info) {
r = *(this->rows[row]+col*3);
g = *(this->rows[row]+col*3+1);
b = *(this->rows[row]+col*3+2);
- y = (FIX(0.299) * r + FIX(0.587) * g + FIX(0.114) * b + ONE_HALF)
+ y = (FIX(0.257) * r + FIX(0.504) * g + FIX(0.098) * b + ONE_HALF + FOOTROOM)
>> SCALEBITS;
if (!(col & 0x0001)) {
/* even pixel, do u */
- u = (- FIX(0.16874) * r - FIX(0.33126) * g + FIX(0.5) * b
+ u = (- FIX(0.148) * r - FIX(0.291) * g + FIX(0.439) * b
+ CBCR_OFFSET + ONE_HALF-1) >> SCALEBITS;
*out = ( (uint16_t) u << 8) | (uint16_t) y;
} else {
/* odd pixel, do v */
- v = (FIX(0.5) * r - FIX(0.41869) * g - FIX(0.08131) * b
+ v = (FIX(0.439) * r - FIX(0.368) * g - FIX(0.071) * b
+ CBCR_OFFSET + ONE_HALF-1) >> SCALEBITS;
*out = ( (uint16_t) v << 8) | (uint16_t) y;
}