<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 6, 2013 at 4:07 AM, <span dir="ltr"><<a href="mailto:deepthi@multicorewareinc.com" target="_blank">deepthi@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Deepthi Nandakumar <<a href="mailto:deepthi@multicorewareinc.com">deepthi@multicorewareinc.com</a>><br>
# Date 1383732437 -19800<br>
# Node ID e1b87cf4133e481cea131882ec5cf6bf80e55846<br>
# Parent bc99537483f101547312a589ceb3d428c176cfed<br>
YUV, Y4M Output: bitdepth confusion resolved<br>
<br>
diff -r bc99537483f1 -r e1b87cf4133e source/output/y4m.cpp<br>
--- a/source/output/y4m.cpp Tue Nov 05 22:21:55 2013 -0600<br>
+++ b/source/output/y4m.cpp Wed Nov 06 15:37:17 2013 +0530<br>
@@ -67,41 +67,38 @@<br>
ofs.seekp(outPicPos);<br>
ofs << "FRAME\n";<br>
<br>
- if (pic.bitDepth > 8)<br>
+#if HIGH_BIT_DEPTH<br>
+ // encoder gave us short pixels, downshift, then write<br>
+ int shift = pic.bitDepth - 8;<br>
+ if (pic.poc == 0)<br></blockquote><div><br></div><div>I tweaked this so the warning message is not emitted if shift is 0</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
{<br>
- // encoder gave us short pixels, downshift, then write<br>
- int shift = pic.bitDepth - 8;<br>
- if (pic.poc == 0)<br>
+ x265_log(NULL, X265_LOG_WARNING, "y4m: down-shifting reconstructed pixels to 8 bits\n");<br>
+ }<br>
+ for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)<br>
+ {<br>
+ uint16_t *src = (uint16_t*)pic.planes[i];<br>
+ for (int h = 0; h < height >> x265_cli_csps[colorSpace].height[i]; h++)<br>
{<br>
- x265_log(NULL, X265_LOG_WARNING, "y4m: down-shifting reconstructed pixels to 8 bits\n");<br>
- }<br>
- for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)<br>
- {<br>
- uint16_t *src = (uint16_t*)pic.planes[i];<br>
- for (int h = 0; h < height >> x265_cli_csps[colorSpace].height[i]; h++)<br>
+ for (int w = 0; w < width >> x265_cli_csps[colorSpace].width[i]; w++)<br>
{<br>
- for (int w = 0; w < width >> x265_cli_csps[colorSpace].width[i]; w++)<br>
- {<br>
- buf[w] = (char)(src[w] >> shift);<br>
- }<br>
+ buf[w] = (char)(src[w] >> shift);<br>
+ }<br>
<br>
- ofs.write(buf, width >> x265_cli_csps[colorSpace].width[i]);<br>
- src += pic.stride[i];<br>
- }<br>
+ ofs.write(buf, width >> x265_cli_csps[colorSpace].width[i]);<br>
+ src += pic.stride[i];<br>
}<br>
}<br>
- else<br>
+#else<br>
+ for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)<br>
{<br>
- for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)<br>
+ char *src = (char*)pic.planes[i];<br>
+ for (int h = 0; h < height >> x265_cli_csps[colorSpace].height[i]; h++)<br>
{<br>
- char *src = (char*)pic.planes[i];<br>
- for (int h = 0; h < height >> x265_cli_csps[colorSpace].height[i]; h++)<br>
- {<br>
- ofs.write(src, width >> x265_cli_csps[colorSpace].width[i]);<br>
- src += pic.stride[i];<br>
- }<br>
+ ofs.write(src, width >> x265_cli_csps[colorSpace].width[i]);<br>
+ src += pic.stride[i];<br>
}<br>
}<br>
+#endif<br>
<br>
PPAStopCpuEventFunc(write_yuv);<br>
return true;<br>
diff -r bc99537483f1 -r e1b87cf4133e source/output/yuv.cpp<br>
--- a/source/output/yuv.cpp Tue Nov 05 22:21:55 2013 -0600<br>
+++ b/source/output/yuv.cpp Wed Nov 06 15:37:17 2013 +0530<br>
@@ -57,30 +57,27 @@<br>
uint32_t pixelbytes = (depth > 8) ? 2 : 1;<br>
ofs.seekp(pic.poc * frameSize * pixelbytes);<br>
<br>
- if (pic.bitDepth > 8)<br>
+#if HIGH_BIT_DEPTH<br>
+ for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)<br></blockquote><div><br></div><div>and I tweaked this to output 8bit YUV pictures if bitDepth is 8</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
{<br>
- for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)<br>
+ uint16_t *src = (uint16_t*)pic.planes[0];<br>
+ for (int h = 0; h < height; h++)<br>
{<br>
- uint16_t *src = (uint16_t*)pic.planes[0];<br>
- for (int h = 0; h < height; h++)<br>
- {<br>
- ofs.write((const char*)src, (width * pixelbytes) >> x265_cli_csps[colorSpace].width[i]);<br>
- src += pic.stride[i];<br>
- }<br>
+ ofs.write((const char*)src, (width * pixelbytes) >> x265_cli_csps[colorSpace].width[i]);<br>
+ src += pic.stride[i];<br>
}<br>
- }<br>
- else<br>
+ }<br>
+#else<br>
+ for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)<br>
{<br>
- for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)<br>
+ char *src = (char*)pic.planes[0];<br>
+ for (int h = 0; h < height; h++)<br>
{<br>
- char *src = (char*)pic.planes[0];<br>
- for (int h = 0; h < height; h++)<br>
- {<br>
- ofs.write(src, width >> x265_cli_csps[colorSpace].width[i]);<br>
- src += pic.stride[i];<br>
- }<br>
+ ofs.write(src, width >> x265_cli_csps[colorSpace].width[i]);<br>
+ src += pic.stride[i];<br>
}<br>
- }<br>
+ }<br>
+#endif<br>
<br>
PPAStopCpuEventFunc(write_yuv);<br>
return true;<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>