diff mbox series

[FFmpeg-devel,21/22] avcodec/libsvtav1: raise strictness of missing DV error

Message ID 20240728102527.17991-21-ffmpeg@haasn.xyz
State New
Headers show
Series [FFmpeg-devel,01/22] avutil/dovi_meta: document static vs dynamic ext blocks | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Niklas Haas July 28, 2024, 10:25 a.m. UTC
From: Niklas Haas <git@haasn.dev>

While this is technically a spec violation, the result is still
decodable (and will look perfectly fine to clients ignoring Dolby Vision
metadata). It will also only happen in garbage in, garbage out scenarios.
---
 libavcodec/libsvtav1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt Aug. 3, 2024, 6:08 p.m. UTC | #1
Niklas Haas:
> From: Niklas Haas <git@haasn.dev>
> 
> While this is technically a spec violation, the result is still
> decodable (and will look perfectly fine to clients ignoring Dolby Vision
> metadata). It will also only happen in garbage in, garbage out scenarios.
> ---
>  libavcodec/libsvtav1.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> index e7b12fb488..4c91750fbe 100644
> --- a/libavcodec/libsvtav1.c
> +++ b/libavcodec/libsvtav1.c
> @@ -551,10 +551,10 @@ static int eb_send_frame(AVCodecContext *avctx, const AVFrame *frame)
>      } else if (svt_enc->dovi.cfg.dv_profile) {
>          av_log(avctx, AV_LOG_ERROR, "Dolby Vision enabled, but received frame "
>                 "without AV_FRAME_DATA_DOVI_METADATA\n");
> -        return AVERROR_INVALIDDATA;
> +        if (avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT)
> +            return AVERROR_INVALIDDATA;
>      }
>  
> -
>      svt_ret = svt_av1_enc_send_picture(svt_enc->svt_handle, headerPtr);
>      if (svt_ret != EB_ErrorNone)
>          return svt_print_error(avctx, svt_ret, "Error sending a frame to encoder");

Encoders are supposed to be picky and only produce spec-compliant output.

- Andreas
Niklas Haas Aug. 4, 2024, 4:31 p.m. UTC | #2
On Sat, 03 Aug 2024 20:08:26 +0200 Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote:
> Niklas Haas:
> > From: Niklas Haas <git@haasn.dev>
> > 
> > While this is technically a spec violation, the result is still
> > decodable (and will look perfectly fine to clients ignoring Dolby Vision
> > metadata). It will also only happen in garbage in, garbage out scenarios.
> > ---
> >  libavcodec/libsvtav1.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> > index e7b12fb488..4c91750fbe 100644
> > --- a/libavcodec/libsvtav1.c
> > +++ b/libavcodec/libsvtav1.c
> > @@ -551,10 +551,10 @@ static int eb_send_frame(AVCodecContext *avctx, const AVFrame *frame)
> >      } else if (svt_enc->dovi.cfg.dv_profile) {
> >          av_log(avctx, AV_LOG_ERROR, "Dolby Vision enabled, but received frame "
> >                 "without AV_FRAME_DATA_DOVI_METADATA\n");
> > -        return AVERROR_INVALIDDATA;
> > +        if (avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT)
> > +            return AVERROR_INVALIDDATA;
> >      }
> >  
> > -
> >      svt_ret = svt_av1_enc_send_picture(svt_enc->svt_handle, headerPtr);
> >      if (svt_ret != EB_ErrorNone)
> >          return svt_print_error(avctx, svt_ret, "Error sending a frame to encoder");
> 
> Encoders are supposed to be picky and only produce spec-compliant output.

Okay, I could either drop this commit or raise it to UNOFFICIAL.

But it probably makes more sense to drop it, such files should be phased out
if they exist anyway.

> 
> - Andreas
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index e7b12fb488..4c91750fbe 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -551,10 +551,10 @@  static int eb_send_frame(AVCodecContext *avctx, const AVFrame *frame)
     } else if (svt_enc->dovi.cfg.dv_profile) {
         av_log(avctx, AV_LOG_ERROR, "Dolby Vision enabled, but received frame "
                "without AV_FRAME_DATA_DOVI_METADATA\n");
-        return AVERROR_INVALIDDATA;
+        if (avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT)
+            return AVERROR_INVALIDDATA;
     }
 
-
     svt_ret = svt_av1_enc_send_picture(svt_enc->svt_handle, headerPtr);
     if (svt_ret != EB_ErrorNone)
         return svt_print_error(avctx, svt_ret, "Error sending a frame to encoder");