[vlc-commits] omxil: Factorize samsung decoder quirk identification to a separate function

Martin Storsjö git at videolan.org
Sat Feb 2 18:15:19 CET 2013


vlc | branch: master | Martin Storsjö <martin at martin.st> | Sat Feb  2 16:33:13 2013 +0200| [4a19daba2ee38598cd13fd6365c669d1fd4c2b7c] | committer: Martin Storsjö

omxil: Factorize samsung decoder quirk identification to a separate function

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 at martin.st>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a19daba2ee38598cd13fd6365c669d1fd4c2b7c
---

 modules/codec/omxil/android_mediacodec.c |    8 +-------
 modules/codec/omxil/omxil.c              |   11 +----------
 modules/codec/omxil/omxil_utils.h        |    2 ++
 modules/codec/omxil/utils.c              |   29 +++++++++++++++++++++++++++++
 4 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index 6956817..c3c7095 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -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;
             }
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index b398680..e976287 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -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;
         }
diff --git a/modules/codec/omxil/omxil_utils.h b/modules/codec/omxil/omxil_utils.h
index c17249d..5bd8fe2 100644
--- a/modules/codec/omxil/omxil_utils.h
+++ b/modules/codec/omxil/omxil_utils.h
@@ -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
  *****************************************************************************/
diff --git a/modules/codec/omxil/utils.c b/modules/codec/omxil/utils.c
index 54e9ec2..9e11fa4 100644
--- a/modules/codec/omxil/utils.c
+++ b/modules/codec/omxil/utils.c
@@ -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
  *****************************************************************************/



More information about the vlc-commits mailing list