<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Jpeg sample cannot read YCbCr Lossless file in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/Jpeg-sample-cannot-read-YCbCr-Lossless-file/m-p/824817#M5092</link>
    <description>Hi Thomas,&lt;BR /&gt;&lt;BR /&gt;I believe this question was discussed on the forum many times. There is nothing in standard JFIF/JPEG file what says you about color space used at compression time that cause JPEG decoder itself and application which calls it have to made a certain assumptions on this. Usually JFIF file with lossy compression for 8-bits 3 color channels considered to be YCbCr image and decoder will apply YCbCr-to-RGB color conversion on it. In case of lossless compression, decoder will assume RGB image.If you know appriory color space used (like in your case if you know that RGB-toYCbCr conversion was applied at compression stage) you just need tospecify JPEG color space to decoder, so it will know thatinverse conversion step is required to correctly reconstruct the original data.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt; Vladimir</description>
    <pubDate>Fri, 07 May 2010 05:57:27 GMT</pubDate>
    <dc:creator>Vladimir_Dudnik</dc:creator>
    <dc:date>2010-05-07T05:57:27Z</dc:date>
    <item>
      <title>Jpeg sample cannot read YCbCr Lossless file</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Jpeg-sample-cannot-read-YCbCr-Lossless-file/m-p/824816#M5091</link>
      <description>I found an image file that UIC sample cannot read properly.&lt;BR /&gt;It is an YCbCy Lossless 8u_c3 Jpeg file. It decodes wrongly to a "swapped rgb channel" image.&lt;BR /&gt;The file is actually a grayscale x-ray image, saved as RGB, but using YCbCr color space, and compressed Losslessly.&lt;BR /&gt;&lt;BR /&gt;When loaded by a properly operating program, it looks like a grayscale x-ray image.&lt;BR /&gt;When loaded by UIC (IPP\\6.1.5.054\\ipp-samples\\image-codecs\\uic\\bin\\win32\\picnic.exe), it looks green with pinks spots.&lt;BR /&gt;&lt;BR /&gt;It seems that, although the decoder sets output color space to RGB, the decoder still puts YCbCr data in the output buffer.&lt;BR /&gt;&lt;BR /&gt;I attached the file:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.intel.com/skins/images/7B13F55A7CE623EF42E69096FA81A3A1/2021_redesign/images/image_not_found.png" /&gt;&lt;/span&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 May 2010 21:36:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Jpeg-sample-cannot-read-YCbCr-Lossless-file/m-p/824816#M5091</guid>
      <dc:creator>Thomas_Jensen1</dc:creator>
      <dc:date>2010-05-06T21:36:32Z</dc:date>
    </item>
    <item>
      <title>Jpeg sample cannot read YCbCr Lossless file</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Jpeg-sample-cannot-read-YCbCr-Lossless-file/m-p/824817#M5092</link>
      <description>Hi Thomas,&lt;BR /&gt;&lt;BR /&gt;I believe this question was discussed on the forum many times. There is nothing in standard JFIF/JPEG file what says you about color space used at compression time that cause JPEG decoder itself and application which calls it have to made a certain assumptions on this. Usually JFIF file with lossy compression for 8-bits 3 color channels considered to be YCbCr image and decoder will apply YCbCr-to-RGB color conversion on it. In case of lossless compression, decoder will assume RGB image.If you know appriory color space used (like in your case if you know that RGB-toYCbCr conversion was applied at compression stage) you just need tospecify JPEG color space to decoder, so it will know thatinverse conversion step is required to correctly reconstruct the original data.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt; Vladimir</description>
      <pubDate>Fri, 07 May 2010 05:57:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Jpeg-sample-cannot-read-YCbCr-Lossless-file/m-p/824817#M5092</guid>
      <dc:creator>Vladimir_Dudnik</dc:creator>
      <dc:date>2010-05-07T05:57:27Z</dc:date>
    </item>
    <item>
      <title>Jpeg sample cannot read YCbCr Lossless file</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Jpeg-sample-cannot-read-YCbCr-Lossless-file/m-p/824818#M5093</link>
      <description>The code in jpegdec.cpp contains:&lt;BR /&gt;&lt;BR /&gt;if(JO_READ_HEADER == op)&lt;BR /&gt; {&lt;BR /&gt; // detect JPEG color space&lt;BR /&gt; if(m_jfif_app0_detected)&lt;BR /&gt; {&lt;BR /&gt; switch(m_jpeg_ncomp)&lt;BR /&gt; {&lt;BR /&gt; case 1: m_jpeg_color = JC_GRAY; break;&lt;BR /&gt; case 3: m_jpeg_color = JC_YCBCR; break;&lt;BR /&gt; default: m_jpeg_color = JC_UNKNOWN; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;, and since the file does have an APP0 tag, and since ncomp = 3, then this UIC sample code wrongly assumes that this losslessly compressed Jpeg file has JC_YCBCR color space. It should have assumed JC_RGB color space since compression is lossless.&lt;BR /&gt;&lt;BR /&gt;I added this modification:&lt;BR /&gt;&lt;BR /&gt;case 3: m_jpeg_color = m_jpeg_mode == JPEG_LOSSLESS ? JC_RGB : JC_YCBCR; break;&lt;BR /&gt;&lt;BR /&gt;It seems to fix the problem, but I can't be sure.&lt;BR /&gt;Maybe it should not be JC_RGB for lossless, but JC_UNKNOWN?&lt;BR /&gt;&lt;BR /&gt;I also took a look at keeping the lossless at JC_UNKNOWN, and then fixing the code in ColorConvert():&lt;BR /&gt;// RGB to BGR&lt;BR /&gt; if(m_jpeg_color == JC_RGB &amp;amp;&amp;amp; m_dst.color == JC_BGR)&lt;BR /&gt;&lt;BR /&gt;changed to:&lt;BR /&gt;&lt;BR /&gt;// RGB to BGR&lt;BR /&gt;
 if((m_jpeg_color == JC_RGB || m_jpeg_mode == JPEG_LOSSLESS &amp;amp;&amp;amp; 
m_jpeg_color == JC_UNKNOWN) &amp;amp;&amp;amp; m_dst.color == JC_BGR)&lt;BR /&gt;
&lt;BR /&gt;That also take care of the problem.&lt;BR /&gt;&lt;BR /&gt;I still think UIC sample has a bug, because for lossless comression, it assume YCbCr, whereas it should actually assume nothing, or RGB.&lt;BR /&gt;</description>
      <pubDate>Fri, 07 May 2010 10:05:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Jpeg-sample-cannot-read-YCbCr-Lossless-file/m-p/824818#M5093</guid>
      <dc:creator>Thomas_Jensen1</dc:creator>
      <dc:date>2010-05-07T10:05:12Z</dc:date>
    </item>
    <item>
      <title>Jpeg sample cannot read YCbCr Lossless file</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Jpeg-sample-cannot-read-YCbCr-Lossless-file/m-p/824819#M5094</link>
      <description>&lt;P&gt;I agree that for lossless compressionmore appropriateassumtion should be RGB for 3-channel image. We will check and correct if that is not true. Just note, that such assumption is not part of JPEG standard.&lt;BR /&gt;&lt;BR /&gt;Vladimir&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2010 21:03:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Jpeg-sample-cannot-read-YCbCr-Lossless-file/m-p/824819#M5094</guid>
      <dc:creator>Vladimir_Dudnik</dc:creator>
      <dc:date>2010-05-07T21:03:02Z</dc:date>
    </item>
    <item>
      <title>Jpeg sample cannot read YCbCr Lossless file</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Jpeg-sample-cannot-read-YCbCr-Lossless-file/m-p/824820#M5095</link>
      <description>Today, IPP sample code assumes a 3-channel image is YCbCr, that is certainly a wrong assumption.&lt;BR /&gt;</description>
      <pubDate>Sun, 09 May 2010 00:34:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Jpeg-sample-cannot-read-YCbCr-Lossless-file/m-p/824820#M5095</guid>
      <dc:creator>Thomas_Jensen1</dc:creator>
      <dc:date>2010-05-09T00:34:26Z</dc:date>
    </item>
  </channel>
</rss>

