diff mbox series

[FFmpeg-devel] lavc/hevc: set correct chroma location

Message ID 20200622220153.7664-1-steinar+ffmpeg@gunderson.no
State New
Headers show
Series [FFmpeg-devel] lavc/hevc: set correct chroma location
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Steinar H. Gunderson June 22, 2020, 10:01 p.m. UTC
HEVC is left chroma like H.264, so add the proper location on init.

Signed-off-by: Steinar H. Gunderson <steinar+ffmpeg@gunderson.no>
---
 libavcodec/hevcdec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Hendrik Leppkes June 22, 2020, 10:07 p.m. UTC | #1
On Tue, Jun 23, 2020 at 12:02 AM Steinar H. Gunderson
<steinar+ffmpeg@gunderson.no> wrote:
>
> HEVC is left chroma like H.264, so add the proper location on init.
>
> Signed-off-by: Steinar H. Gunderson <steinar+ffmpeg@gunderson.no>
> ---
>  libavcodec/hevcdec.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index c9e28f5826..3306cf3702 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -3534,6 +3534,8 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx)
>          else
>              s->threads_type = FF_THREAD_SLICE;
>
> +    avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
> +

This is not correct. The chroma location can vary and is signaled in
the bitstream.

I actually send a patch to the ML a while back to do this properly,
but apparently it slipped through the cracks. I'll revive it.

- Hendrik
diff mbox series

Patch

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index c9e28f5826..3306cf3702 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -3534,6 +3534,8 @@  static av_cold int hevc_decode_init(AVCodecContext *avctx)
         else
             s->threads_type = FF_THREAD_SLICE;
 
+    avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
+
     return 0;
 }