Merge upstream version 2.0.1 from upstream into tizen
[platform/upstream/libjpeg-turbo.git] / jquant2.c
index 0ce0ca5..dbc5199 100644 (file)
--- a/jquant2.c
+++ b/jquant2.c
@@ -508,9 +508,17 @@ compute_color(j_decompress_ptr cinfo, boxptr boxp, int icolor)
       }
     }
 
+#if _USE_PRODUCT_TV
+  if(total != 0) {
+    cinfo->colormap[0][icolor] = (JSAMPLE)((c0total + (total>>1)) / total);
+    cinfo->colormap[1][icolor] = (JSAMPLE)((c1total + (total>>1)) / total);
+    cinfo->colormap[2][icolor] = (JSAMPLE)((c2total + (total>>1)) / total);
+  }
+#else
   cinfo->colormap[0][icolor] = (JSAMPLE)((c0total + (total >> 1)) / total);
   cinfo->colormap[1][icolor] = (JSAMPLE)((c1total + (total >> 1)) / total);
   cinfo->colormap[2][icolor] = (JSAMPLE)((c2total + (total >> 1)) / total);
+#endif
 }