]> granicus.if.org Git - handbrake/commitdiff
QSV: minor cleanup.
authorRodeo <tdskywalker@gmail.com>
Sun, 1 Sep 2013 09:44:45 +0000 (09:44 +0000)
committerRodeo <tdskywalker@gmail.com>
Sun, 1 Sep 2013 09:44:45 +0000 (09:44 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5760 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/enc_qsv.c
libhb/qsv_common.c
libhb/qsv_common.h

index 7ec9a8612f1ba553f206370c3529f19d12a025d9..395f32b4174326be192d50228ef9b7c6efe0dbef 100644 (file)
@@ -846,76 +846,14 @@ int encqsvInit(hb_work_object_t *w, hb_job_t *job)
                      videoParam.mfx.FrameInfo.PicStruct);
             return -1;
     }
-    const char *cavlc, *rdopt;
-    switch (option1->CAVLC)
-    {
-        case MFX_CODINGOPTION_ON:
-            cavlc = "on";
-            break;
-        case MFX_CODINGOPTION_OFF:
-            cavlc = "off";
-            break;
-        default:
-            hb_error("encqsvInit: invalid CAVLC value %"PRIu16"",
-                     option1->CAVLC);
-            return -1;
-    }
-    switch (option1->RateDistortionOpt)
-    {
-        case MFX_CODINGOPTION_ON:
-            rdopt = "on";
-            break;
-        case MFX_CODINGOPTION_OFF:
-            rdopt = "off";
-            break;
-        default:
-            hb_error("encqsvInit: invalid RateDistortionOpt value %"PRIu16"",
-                     option1->RateDistortionOpt);
-            return -1;
-    }
-    hb_log("encqsvInit: CAVLC %s RateDistortionOpt %s", cavlc, rdopt);
+    hb_log("encqsvInit: CAVLC %-3s RateDistortionOpt %-3s",
+           hb_qsv_codingoption_get_name(option1->CAVLC),
+           hb_qsv_codingoption_get_name(option1->RateDistortionOpt));
     if (hb_qsv_info->capabilities & HB_QSV_CAP_OPTION2_BRC)
     {
-        const char *mbbrc, *extbrc;
-        switch (option2->MBBRC)
-        {
-            case MFX_CODINGOPTION_ON:
-                mbbrc = "on";
-                break;
-            case MFX_CODINGOPTION_OFF:
-                mbbrc = "off";
-                break;
-            case MFX_CODINGOPTION_ADAPTIVE:
-                mbbrc = "adaptive";
-                break;
-            case MFX_CODINGOPTION_UNKNOWN:
-                mbbrc = "unknown (auto)";
-                break;
-            default:
-                hb_error("encqsvInit: invalid MBBRC value %"PRIu16"",
-                         option2->MBBRC);
-                return -1;
-        }
-        switch (option2->ExtBRC)
-        {
-            case MFX_CODINGOPTION_ON:
-                extbrc = "on";
-                break;
-            case MFX_CODINGOPTION_OFF:
-                extbrc = "off";
-                break;
-            case MFX_CODINGOPTION_ADAPTIVE:
-                extbrc = "adaptive";
-                break;
-            case MFX_CODINGOPTION_UNKNOWN:
-                extbrc = "unknown (auto)";
-                break;
-            default:
-                hb_error("encqsvInit: invalid ExtBRC value %"PRIu16"",
-                         option2->ExtBRC);
-                return -1;
-        }
-        hb_log("encqsvInit: MBBRC %s ExtBRC %s", mbbrc, extbrc);
+        hb_log("encqsvInit: MBBRC %-3s ExtBRC %-3s",
+               hb_qsv_codingoption_get_name(option2->MBBRC),
+               hb_qsv_codingoption_get_name(option2->ExtBRC));
     }
     if (hb_qsv_info->capabilities & HB_QSV_CAP_OPTION2_TRELLIS)
     {
index 9d06ce3ecdee203f734a66505482d9273a201660..210a9138827d1f797a9b6bcb766f2dbd02ca63b5 100644 (file)
@@ -227,6 +227,23 @@ int hb_qsv_trellisvalue_xlat(int val)
     }
 }
 
+const char* hb_qsv_codingoption_get_name(int val)
+{
+    switch (val)
+    {
+        case MFX_CODINGOPTION_ON:
+            return "on";
+        case MFX_CODINGOPTION_OFF:
+            return "off";
+        case MFX_CODINGOPTION_ADAPTIVE:
+            return "adaptive";
+        case MFX_CODINGOPTION_UNKNOWN:
+            return "unknown (auto)";
+        default:
+            return NULL;
+    }
+}
+
 int hb_qsv_atoindex(const char* const *arr, const char *str, int *err)
 {
     int i;
index 9e9b58f30a186b8d813ca61c251572b056c3f7bd..57b7c1685437bcc076bdf05b85d58a9a7abb32a5 100644 (file)
@@ -106,7 +106,9 @@ typedef struct
 } hb_qsv_param_t;
 
 #define HB_QSV_CLIP3(min, max, val) ((val < min) ? min : (val > max) ? max : val)
-int   hb_qsv_codingoption_xlat(int val);
+int         hb_qsv_codingoption_xlat    (int val);
+const char* hb_qsv_codingoption_get_name(int val);
+
 int   hb_qsv_trellisvalue_xlat(int val);
 int   hb_qsv_atoindex(const char* const *arr, const char *str, int *err);
 int   hb_qsv_atobool (const char *str, int *err);