[x265] [PATCH] input/y4m: support all bit depths from 'mono9' to 'mono16' in y4m

Ma0 mateuszb at poczta.onet.pl
Fri Oct 13 12:39:44 CEST 2017


# HG changeset patch
# User Ma0 <mateuszb at poczta.onet.pl>
# Date 1507448003 -7200
#      Sun Oct 08 09:33:23 2017 +0200
# Node ID daef862c9d0a5d2b2a1e1e8da7ec56facfa08272
# Parent  0e168bdeb48b3d57d896d3823e2efb2bf69d4b26
input/y4m: support all bit depths from 'mono9' to 'mono16' in y4m

diff -r 0e168bdeb48b -r daef862c9d0a source/input/y4m.cpp
--- a/source/input/y4m.cpp	Mon Oct 09 12:34:25 2017 +0530
+++ b/source/input/y4m.cpp	Sun Oct 08 09:33:23 2017 +0200
@@ -307,23 +307,26 @@
                         break;
                 }
 
-                switch (csp)
+                if (csp / 100 == ('m'-'0')*1000 + ('o'-'0')*100 + ('n'-'0')*10 + ('o'-'0'))
                 {
-                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'):
+                    d = csp % 100;
+                }
+                else if (csp / 10 == ('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;
+                    d = csp % 10;
+                }
+                else if (csp == ('m'-'0')*1000 + ('o'-'0')*100 + ('n'-'0')*10 + ('o'-'0'))
+                {
+                    colorSpace = X265_CSP_I400;
+                    d = 8;
+                }
+                else
                     colorSpace = (csp == 444) ? X265_CSP_I444 : (csp == 422) ? X265_CSP_I422 : X265_CSP_I420;
-                }
+
+                if (d >= 8 && d <= 16)
+                    depth = d;
                 break;
 
             default:


More information about the x265-devel mailing list