<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 20, 2014 at 2:31 PM,  <span dir="ltr"><<a href="mailto:dtyx265@gmail.com" target="_blank">dtyx265@gmail.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 David T Yuen <<a href="mailto:dtyx265@gmail.com">dtyx265@gmail.com</a>><br>
# Date 1392928085 28800<br>
# Node ID 648dcea58040691e9ca56dd71e33b619e8769fa8<br>
# Parent  db784e7cf7d8b58723dd9e5d6bea8c46c5102a15<br>
user: David T Yuen <<a href="mailto:dtyx265@gmail.com">dtyx265@gmail.com</a>><br>
branch 'default'<br>
changed source/common/common.cpp<br>
<br>
Added parameter checking for VUI parameters<br></blockquote><div><br></div><div>in general, this looks good. some nits below</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
diff -r db784e7cf7d8 -r 648dcea58040 source/common/common.cpp<br>
--- a/source/common/common.cpp  Thu Feb 20 08:24:11 2014 -0800<br>
+++ b/source/common/common.cpp  Thu Feb 20 12:28:05 2014 -0800<br>
@@ -549,6 +549,29 @@<br>
     }<br>
<br>
     CHECK(param->bEnableWavefront < 0, "WaveFrontSynchro cannot be negative");<br>
+    CHECK((param->aspectRatioIdc < 0 || param->aspectRatioIdc > 16) &&<br>
+           param->aspectRatioIdc != 255, "Sample Aspect Ratio must be 0-16 or 255");<br>
+    CHECK(param->sarWidth < 0, "Sample Aspect Ratio width must be greater than 0");<br>
+    CHECK(param->sarHeight < 0, "Sample Aspect Ratio height must be greater than 0");<br>
+    CHECK(param->videoFormat < 0 || param->videoFormat > 5,<br>
+         "Video Format must be Component component, pal, ntsc, secam, mac or undef");<br>
+    CHECK(param->colorPrimaries < 0 || param->colorPrimaries > 9<br>
+          || param->colorPrimaries == 3, "Color Primaries must be undef, bt709, bt470m, bt470bg, smpte170m, smpte240m, film or bt2020");<br>
+    CHECK(param->transferCharacteristics < 0 || param->transferCharacteristics > 15<br>
+          || param->transferCharacteristics == 3, "Transfer Characteristics must be undef, bt709, bt470m, bt470bg, smpte170m, smpte240m, linear, log100, log316, iec61966-2-4, bt1361e, iec61966-2-1, bt2020-10 or bt2020-12");<br>
</blockquote><div><br></div><div>Can you split this string?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    CHECK(param->matrixCoeffs < 0 || param->matrixCoeffs > 10 || param->matrixCoeffs == 3,<br>
+          "Matrix Coefficients must be undef, bt709, fcc, bt470bg, smpte170m, smpte240m, GBR, YCgCo, bt2020nc or bt2020c");<br>
+    CHECK(param->chromaSampleLocTypeTopField < 0 || param->chromaSampleLocTypeTopField > 5,<br>
+          "Chroma Sample Location Type Top Field must be 0-5");<br>
+    CHECK(param->chromaSampleLocTypeBottomField < 0 || param->chromaSampleLocTypeBottomField > 5,<br>
+          "Chroma Sample Location Type Bottom Field must be 0-5");<br>
+    CHECK(param->defDispWinLeftOffset < 0, "Default Display Window Left Offset must be 0 or greater");<br>
+    CHECK(param->defDispWinRightOffset < 0, "Default Display Window Right Offset must be 0 or greater")<br>
+;<br></blockquote><div><br></div><div>these semicolons somehow ended up on their own lines</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    CHECK(param->defDispWinTopOffset < 0, "Default Display Window Top Offset must be 0 or greater")<br>
+;<br>
+    CHECK(param->defDispWinBottomOffset < 0, "Default Display Window Bottom Offset must be 0 or greater")<br>
+;<br>
     return check_failed;<br>
 }<br>
<br>
@@ -849,6 +872,8 @@<br>
             p->videoFormat = 4;<br>
         else if (!strcmp(value, "undef"))<br>
             p->videoFormat = 5;<br>
+        else<br>
+            p->videoFormat = -1;<br>
     }<br>
     OPT("range")<br>
     {<br>
@@ -877,6 +902,8 @@<br>
             p->colorPrimaries = 8;<br>
         else if (!strcmp(value, "bt2020"))<br>
             p->colorPrimaries = 9;<br>
+        else<br>
+            p->colorPrimaries = -1;<br>
     }<br>
     OPT("transfer")<br>
     {<br>
@@ -911,6 +938,8 @@<br>
             p->transferCharacteristics = 14;<br>
         else if (!strcmp(value, "bt2020-12"))<br>
             p->transferCharacteristics = 15;<br>
+        else<br>
+            p->transferCharacteristics = -1;<br>
     }<br>
     OPT("colormatrix")<br>
     {<br>
@@ -937,6 +966,8 @@<br>
             p->matrixCoeffs = 9;<br>
         else if (!strcmp(value, "bt2020c"))<br>
             p->matrixCoeffs = 10;<br>
+        else<br>
+            p->matrixCoeffs = -1;<br>
     }<br>
     OPT("chromaloc")<br>
     {<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>