]> git.sesse.net Git - vlc/commitdiff
omxil: Factorize samsung decoder quirk identification to a separate function
authorMartin Storsjö <martin@martin.st>
Sat, 2 Feb 2013 14:33:13 +0000 (16:33 +0200)
committerMartin Storsjö <martin@martin.st>
Sat, 2 Feb 2013 17:15:07 +0000 (19:15 +0200)
Previously, we tried to see if the samsung decoder name followed
a certain pattern (ending .Decoder, for good decoders, assuming
we should ignore the padding specified by all other samsung
decoders). This simple pattern didn't turn out to apply for some
other deocders, so instead explicitly list the components that
we know we should ignore the specified padding values.

Also refactor the same check from both the omxil and mediacodec
files into one utility function.

Signed-off-by: Martin Storsjö <martin@martin.st>
modules/codec/omxil/android_mediacodec.c
modules/codec/omxil/omxil.c
modules/codec/omxil/omxil_utils.h
modules/codec/omxil/utils.c

index 6956817f1dc5a8ddb35a3c5bff02e269ce8a70d0..c3c7095934bb1ad2e3fda817db1eeafd38ac0d1b 100644 (file)
@@ -478,13 +478,7 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, int loo
                 p_sys->crop_top = 0;
                 p_sys->crop_left = 0;
             }
-            /* Workaround for some Samsung decoders, the ones named e.g.
-             * OMX.SEC.avc.dec don't have any padding between planes (while
-             * the slice height signals that they would have). The ones
-             * named OMX.SEC.AVC.Decoder have proper slice height as the
-             * parameter indicates. */
-            if (!strncmp(p_sys->name, "OMX.SEC.", strlen("OMX.SEC.")) &&
-                !strstr(p_sys->name, ".Decoder")) {
+            if (IgnoreOmxDecoderPadding(p_sys->name)) {
                 p_sys->slice_height = 0;
                 p_sys->stride = p_dec->fmt_out.video.i_width;
             }
index b398680a5511fa55133b8680314ec0f5187b1f03..e976287fe1b2a6a9be3418f0e537e56571e60dcd 100644 (file)
@@ -518,16 +518,7 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
                     strlen("OMX.qcom.video.decoder")))
             def->format.video.eColorFormat = OMX_QCOM_COLOR_FormatYVU420SemiPlanar;
 
-        /* Hack: Some Samsung devices (e.g. Galaxy S III) have multiple
-         * H264 decoders with different quirks (OMX.SEC.avc.dec, OMX.SEC.avcdec
-         * and OMX.SEC.AVC.Decoder) - the latter is well-behaved while the
-         * former ones signal padding but in practice doesn't have any padding.
-         * We can't simply ignore the buggy ones, because some devices only
-         * have that one (Galaxy S II has only got one named OMX.SEC.avcdec,
-         * at least in the pre-4.0 firmwares). Thus, we enable this quirk on
-         * any OMX.SEC. decoder that doesn't contain the string ".Decoder". */
-        if(!strncmp(p_sys->psz_component, "OMX.SEC.", strlen("OMX.SEC.")) &&
-           !strstr(p_sys->psz_component, ".Decoder")) {
+        if (IgnoreOmxDecoderPadding(p_sys->psz_component)) {
             def->format.video.nSliceHeight = 0;
             def->format.video.nStride = p_fmt->video.i_width;
         }
index c17249dbb73b60acf99d555207a22bdae17766b7..5bd8fe237026b4997a5c010a77a00195e7bbe67c 100644 (file)
@@ -137,6 +137,8 @@ void CopyOmxPicture( int i_color_format, picture_t *p_pic,
 
 void CopyVlcPicture( decoder_t *, OMX_BUFFERHEADERTYPE *, picture_t * );
 
+int IgnoreOmxDecoderPadding(const char *psz_name);
+
 /*****************************************************************************
  * Logging utility functions
  *****************************************************************************/
index 54e9ec209a7ece57c0f45ebf432bb1374cffc30a..9e11fa42525b694bccb29cad2f1bd1b61e4d2770 100644 (file)
@@ -182,6 +182,35 @@ void CopyVlcPicture( decoder_t *p_dec, OMX_BUFFERHEADERTYPE *p_header,
     }
 }
 
+int IgnoreOmxDecoderPadding(const char *name)
+{
+    // The list of decoders that signal padding properly is not necessary,
+    // since that is the default, but keep it here for reference. (This is
+    // only relevant for manufacturers that are known to have decoders with
+    // this kind of bug.)
+    // Unknown: OMX.SEC.vc1.dec (wmv9/vc1 - lack of samples that have cropping)
+/*
+    static const char *padding_decoders[] = {
+        "OMX.SEC.AVC.Decoder",
+        "OMX.SEC.wmv7.dec",
+        "OMX.SEC.wmv8.dec",
+        NULL
+    };
+*/
+    static const char *nopadding_decoders[] = {
+        "OMX.SEC.avc.dec",
+        "OMX.SEC.avcdec",
+        "OMX.SEC.MPEG4.Decoder",
+        "OMX.SEC.mpeg4.dec",
+        NULL
+    };
+    for (const char **ptr = nopadding_decoders; *ptr; ptr++) {
+        if (!strcmp(*ptr, name))
+            return 1;
+    }
+    return 0;
+}
+
 /*****************************************************************************
  * Logging utility functions
  *****************************************************************************/