diff mbox

[FFmpeg-devel,4/5] av1_metadata: Fix constraint on setting chroma_sample_position

Message ID 20181004230947.9658-4-sw@jkqxz.net
State Accepted
Headers show

Commit Message

Mark Thompson Oct. 4, 2018, 11:09 p.m. UTC
It can't be set for 4:2:2 streams.
---
 libavcodec/av1_metadata_bsf.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

James Almer Oct. 5, 2018, midnight UTC | #1
On 10/4/2018 8:09 PM, Mark Thompson wrote:
> It can't be set for 4:2:2 streams.
> ---
>  libavcodec/av1_metadata_bsf.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/av1_metadata_bsf.c b/libavcodec/av1_metadata_bsf.c
> index 20c3a39da7..52d383661f 100644
> --- a/libavcodec/av1_metadata_bsf.c
> +++ b/libavcodec/av1_metadata_bsf.c
> @@ -86,13 +86,9 @@ static int av1_metadata_update_sequence_header(AVBSFContext *bsf,
>      }
>  
>      if (ctx->chroma_sample_position >= 0) {
> -        if (clc->mono_chrome) {
> +        if (clc->mono_chrome || !clc->subsampling_x || !clc->subsampling_y) {
>              av_log(bsf, AV_LOG_WARNING, "Warning: chroma_sample_position "
> -                   "is not meaningful for monochrome streams.\n");
> -        } else if (clc->subsampling_x == 0 &&
> -                   clc->subsampling_y == 0) {
> -            av_log(bsf, AV_LOG_WARNING, "Warning: chroma_sample_position "
> -                   "is not meaningful for non-chroma-subsampled streams.\n");
> +                   "can only be set for 4:2:0 streams.\n");
>          } else {
>              clc->chroma_sample_position = ctx->chroma_sample_position;
>          }

LGTM
diff mbox

Patch

diff --git a/libavcodec/av1_metadata_bsf.c b/libavcodec/av1_metadata_bsf.c
index 20c3a39da7..52d383661f 100644
--- a/libavcodec/av1_metadata_bsf.c
+++ b/libavcodec/av1_metadata_bsf.c
@@ -86,13 +86,9 @@  static int av1_metadata_update_sequence_header(AVBSFContext *bsf,
     }
 
     if (ctx->chroma_sample_position >= 0) {
-        if (clc->mono_chrome) {
+        if (clc->mono_chrome || !clc->subsampling_x || !clc->subsampling_y) {
             av_log(bsf, AV_LOG_WARNING, "Warning: chroma_sample_position "
-                   "is not meaningful for monochrome streams.\n");
-        } else if (clc->subsampling_x == 0 &&
-                   clc->subsampling_y == 0) {
-            av_log(bsf, AV_LOG_WARNING, "Warning: chroma_sample_position "
-                   "is not meaningful for non-chroma-subsampled streams.\n");
+                   "can only be set for 4:2:0 streams.\n");
         } else {
             clc->chroma_sample_position = ctx->chroma_sample_position;
         }