diff mbox series

[FFmpeg-devel,v2] avcodec/libsvtav1: add support for setting chroma sample location

Message ID 20220425215923.68551-1-jeebjp@gmail.com
State Accepted
Commit ded0334d214f9617122ccf5466f99df5c908277b
Headers show
Series [FFmpeg-devel,v2] avcodec/libsvtav1: add support for setting chroma sample location | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Jan Ekström April 25, 2022, 9:59 p.m. UTC
Support for configuring this was added with version 1.0.0.
---
 libavcodec/libsvtav1.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

James Almer April 25, 2022, 11:44 p.m. UTC | #1
On 4/25/2022 6:59 PM, Jan Ekström wrote:
> Support for configuring this was added with version 1.0.0.
> ---
>   libavcodec/libsvtav1.c | 27 +++++++++++++++++++++++++++
>   1 file changed, 27 insertions(+)
> 
> diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> index 2e3d96ce37..49c396387f 100644
> --- a/libavcodec/libsvtav1.c
> +++ b/libavcodec/libsvtav1.c
> @@ -205,6 +205,33 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
>       else
>           param->color_range = !!(desc->flags & AV_PIX_FMT_FLAG_RGB);
>   
> +#if SVT_AV1_CHECK_VERSION(1, 0, 0)
> +    if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) {
> +        const char *name =
> +            av_chroma_location_name(avctx->chroma_sample_location);
> +
> +        switch (avctx->chroma_sample_location) {
> +        case AVCHROMA_LOC_LEFT:
> +            param->chroma_sample_position = EB_CSP_VERTICAL;
> +            break;
> +        case AVCHROMA_LOC_TOPLEFT:
> +            param->chroma_sample_position = EB_CSP_COLOCATED;
> +            break;
> +        default:
> +            if (!name)
> +                break;
> +
> +            av_log(avctx, AV_LOG_WARNING,
> +                   "Specified chroma sample location %s is unsupported "
> +                   "on the AV1 bit stream level. Usage of a container that "
> +                   "allows passing this information - such as Matroska - "
> +                   "is recommended.\n",
> +                   name);
> +            break;
> +        }
> +    }
> +#endif
> +
>       if (avctx->profile != FF_PROFILE_UNKNOWN)
>           param->profile = avctx->profile;

Should be ok.
Jan Ekström April 26, 2022, 6:19 a.m. UTC | #2
On Tue, Apr 26, 2022 at 2:44 AM James Almer <jamrial@gmail.com> wrote:
>
> On 4/25/2022 6:59 PM, Jan Ekström wrote:
> > Support for configuring this was added with version 1.0.0.
> > ---
> >   libavcodec/libsvtav1.c | 27 +++++++++++++++++++++++++++
> >   1 file changed, 27 insertions(+)
> >
> > diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> > index 2e3d96ce37..49c396387f 100644
> > --- a/libavcodec/libsvtav1.c
> > +++ b/libavcodec/libsvtav1.c
> > @@ -205,6 +205,33 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
> >       else
> >           param->color_range = !!(desc->flags & AV_PIX_FMT_FLAG_RGB);
> >
> > +#if SVT_AV1_CHECK_VERSION(1, 0, 0)
> > +    if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) {
> > +        const char *name =
> > +            av_chroma_location_name(avctx->chroma_sample_location);
> > +
> > +        switch (avctx->chroma_sample_location) {
> > +        case AVCHROMA_LOC_LEFT:
> > +            param->chroma_sample_position = EB_CSP_VERTICAL;
> > +            break;
> > +        case AVCHROMA_LOC_TOPLEFT:
> > +            param->chroma_sample_position = EB_CSP_COLOCATED;
> > +            break;
> > +        default:
> > +            if (!name)
> > +                break;
> > +
> > +            av_log(avctx, AV_LOG_WARNING,
> > +                   "Specified chroma sample location %s is unsupported "
> > +                   "on the AV1 bit stream level. Usage of a container that "
> > +                   "allows passing this information - such as Matroska - "
> > +                   "is recommended.\n",
> > +                   name);
> > +            break;
> > +        }
> > +    }
> > +#endif
> > +
> >       if (avctx->profile != FF_PROFILE_UNKNOWN)
> >           param->profile = avctx->profile;
>
> Should be ok.

Thanks, applied as ded0334d214f9617122ccf5466f99df5c908277b .

Jan
diff mbox series

Patch

diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 2e3d96ce37..49c396387f 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -205,6 +205,33 @@  static int config_enc_params(EbSvtAv1EncConfiguration *param,
     else
         param->color_range = !!(desc->flags & AV_PIX_FMT_FLAG_RGB);
 
+#if SVT_AV1_CHECK_VERSION(1, 0, 0)
+    if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) {
+        const char *name =
+            av_chroma_location_name(avctx->chroma_sample_location);
+
+        switch (avctx->chroma_sample_location) {
+        case AVCHROMA_LOC_LEFT:
+            param->chroma_sample_position = EB_CSP_VERTICAL;
+            break;
+        case AVCHROMA_LOC_TOPLEFT:
+            param->chroma_sample_position = EB_CSP_COLOCATED;
+            break;
+        default:
+            if (!name)
+                break;
+
+            av_log(avctx, AV_LOG_WARNING,
+                   "Specified chroma sample location %s is unsupported "
+                   "on the AV1 bit stream level. Usage of a container that "
+                   "allows passing this information - such as Matroska - "
+                   "is recommended.\n",
+                   name);
+            break;
+        }
+    }
+#endif
+
     if (avctx->profile != FF_PROFILE_UNKNOWN)
         param->profile = avctx->profile;