Commit 4a19daba authored by Martin Storsjö's avatar 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: default avatarMartin Storsjö <martin@martin.st>
parent 49362976
...@@ -478,13 +478,7 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, int loo ...@@ -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_top = 0;
p_sys->crop_left = 0; p_sys->crop_left = 0;
} }
/* Workaround for some Samsung decoders, the ones named e.g. if (IgnoreOmxDecoderPadding(p_sys->name)) {
* 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")) {
p_sys->slice_height = 0; p_sys->slice_height = 0;
p_sys->stride = p_dec->fmt_out.video.i_width; p_sys->stride = p_dec->fmt_out.video.i_width;
} }
......
...@@ -518,16 +518,7 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port, ...@@ -518,16 +518,7 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
strlen("OMX.qcom.video.decoder"))) strlen("OMX.qcom.video.decoder")))
def->format.video.eColorFormat = OMX_QCOM_COLOR_FormatYVU420SemiPlanar; def->format.video.eColorFormat = OMX_QCOM_COLOR_FormatYVU420SemiPlanar;
/* Hack: Some Samsung devices (e.g. Galaxy S III) have multiple if (IgnoreOmxDecoderPadding(p_sys->psz_component)) {
* 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")) {
def->format.video.nSliceHeight = 0; def->format.video.nSliceHeight = 0;
def->format.video.nStride = p_fmt->video.i_width; def->format.video.nStride = p_fmt->video.i_width;
} }
......
...@@ -137,6 +137,8 @@ void CopyOmxPicture( int i_color_format, picture_t *p_pic, ...@@ -137,6 +137,8 @@ void CopyOmxPicture( int i_color_format, picture_t *p_pic,
void CopyVlcPicture( decoder_t *, OMX_BUFFERHEADERTYPE *, picture_t * ); void CopyVlcPicture( decoder_t *, OMX_BUFFERHEADERTYPE *, picture_t * );
int IgnoreOmxDecoderPadding(const char *psz_name);
/***************************************************************************** /*****************************************************************************
* Logging utility functions * Logging utility functions
*****************************************************************************/ *****************************************************************************/
......
...@@ -182,6 +182,35 @@ void CopyVlcPicture( decoder_t *p_dec, OMX_BUFFERHEADERTYPE *p_header, ...@@ -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 * Logging utility functions
*****************************************************************************/ *****************************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment