[FFmpeg-devel] [PATCH]lavc/h264: Output pix_fmt GRAY for monochrome input.

Michael Niedermayer michael at niedermayer.cc
Fri Aug 31 15:16:59 EEST 2018


On Tue, Aug 07, 2018 at 11:40:08PM +0200, Carl Eugen Hoyos wrote:
[...]

> +                if (h->ps.sps->chroma_format_idc) {
>                      const uint8_t *src_cb = sl->intra_pcm_ptr + 256;
>                      const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8;
>                      for (i = 0; i < block_h; i++) {
> @@ -155,7 +143,7 @@ static av_noinline void FUNC(hl_decode_mb)(const H264Context *h, H264SliceContex
>                  xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize,
>                                 uvlinesize, 1, 0, SIMPLE, PIXEL_SHIFT);
>  
> -            if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {
> +            if (!chroma400 && (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY))) {
>                  h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, uvlinesize);
>                  h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, uvlinesize);
>              }

for all i know chroma400 is a obscure case not commonly occuring in real world
files. So unless iam mistaken, this should not be on the "simple" codepath but
chroma400 should possibly use the complex path instead
slowing down 99.9% of files with extra checks seems suboptimal

also the CONFIG_GRAY checks are already ommited by default 
so as not to slow the common case down for a optimization very few use.
if a check was added in the default and simple path then there would likely
be no advantage in keeping CONFIG_GRAY as a compile time conditional as
the checks would always be build (and could be simplified to a single
field for both features)

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"I am not trying to be anyone's saviour, I'm trying to think about the
 future and not be sad" - Elon Musk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180831/44711483/attachment.sig>


More information about the ffmpeg-devel mailing list