This patch fixes issue #282.

# HG changeset patch
# User Ma0 <mateu...@poczta.onet.pl>
# Date 1476639059 -7200
#      Sun Oct 16 19:30:59 2016 +0200
# Node ID f49487ee92a296a36938dfb92b7b51c9fb7f2ff9
# Parent  c97805dad9148ad3cddba10a67ed5596508e8f86
CLI: allow 'mono' & 'mono16' color space for y4m input

diff -r c97805dad914 -r f49487ee92a2 source/input/y4m.cpp
--- a/source/input/y4m.cpp    Thu Oct 13 17:53:48 2016 +0800
+++ b/source/input/y4m.cpp    Sun Oct 16 19:30:59 2016 +0200
@@ -280,7 +280,7 @@
                 {
                     c = ifs->get();
 
-                    if (c <= '9' && c >= '0')
+                    if (c <= 'o' && c >= '0')
                         csp = csp * 10 + (c - '0');
                     else if (c == 'p')
                     {
@@ -300,9 +300,23 @@
                         break;
                 }
 
-                if (d >= 8 && d <= 16)
-                    depth = d;
-                colorSpace = (csp == 444) ? X265_CSP_I444 : (csp == 422) ? 
X265_CSP_I422 : X265_CSP_I420;
+                switch (csp)
+                {
+                case ('m'-'0')*100000 + ('o'-'0')*10000 + ('n'-'0')*1000 + 
('o'-'0')*100 + 16:
+                    colorSpace = X265_CSP_I400;
+                    depth = 16;
+                    break;
+
+                case ('m'-'0')*1000 + ('o'-'0')*100 + ('n'-'0')*10 + ('o'-'0'):
+                    colorSpace = X265_CSP_I400;
+                    depth = 8;
+                    break;
+                   
+                default:
+                    if (d >= 8 && d <= 16)
+                        depth = d;
+                    colorSpace = (csp == 444) ? X265_CSP_I444 : (csp == 422) ? 
X265_CSP_I422 : X265_CSP_I420;
+                }
                 break;
 
             default:
@@ -324,7 +338,7 @@
     if (width < MIN_FRAME_WIDTH || width > MAX_FRAME_WIDTH ||
         height < MIN_FRAME_HEIGHT || height > MAX_FRAME_HEIGHT ||
         (rateNum / rateDenom) < 1 || (rateNum / rateDenom) > MAX_FRAME_RATE ||
-        colorSpace <= X265_CSP_I400 || colorSpace >= X265_CSP_COUNT)
+        colorSpace < X265_CSP_I400 || colorSpace >= X265_CSP_COUNT)
         return false;
 
     return true;

_______________________________________________
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel

Reply via email to