diff mbox series

[FFmpeg-devel] avcodec/libopenjpeg: set guard bits to 1 for 2K cinema

Message ID CA+NTGJ1j8cH7raXrCB5GEYK5U5X=J0GdxiE4cs9eiFteqoa-zw@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/libopenjpeg: set guard bits to 1 for 2K cinema | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch
yinshiyou/configure_loongarch64 warning Failed to apply patch

Commit Message

Marc-Antoine ARNAUD Nov. 7, 2024, 1:06 p.m. UTC
Signed-off-by: Marc-Antoine Arnaud <marc-antoine.arnaud@luminvent.com>
---
 libavcodec/libopenjpegenc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

     if (!stream) {
--
2.39.3 (Apple Git-146)

Comments

Marc-Antoine ARNAUD Nov. 7, 2024, 1:26 p.m. UTC | #1
Signed-off-by: Marc-Antoine Arnaud <marc-antoine.arnaud@luminvent.com>
---
 libavcodec/libopenjpegenc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index 06937cb9cac..ee2513d2a38 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -691,6 +691,17 @@ static int
libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         ret = AVERROR_EXTERNAL;
         goto done;
     }
+
+    if (ctx->cinema_mode == OPJ_CINEMA2K_24 || ctx->profile ==
OPJ_CINEMA2K) {
+        const char* options[2] = { "GUARD_BITS=1", NULL };
+        opj_encoder_set_extra_options(compress, options);
+    }
+
     stream = opj_stream_default_create(OPJ_STREAM_WRITE);

     if (!stream) {
--
2.39.3 (Apple Git-146)

Le jeu. 7 nov. 2024 à 14:06, Marc-Antoine ARNAUD <
marc-antoine.arnaud@luminvent.com> a écrit :

> Signed-off-by: Marc-Antoine Arnaud <marc-antoine.arnaud@luminvent.com>
> ---
>  libavcodec/libopenjpegenc.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
> index 06937cb9cac..ee2513d2a38 100644
> --- a/libavcodec/libopenjpegenc.c
> +++ b/libavcodec/libopenjpegenc.c
> @@ -691,6 +691,17 @@ static int
> libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>          ret = AVERROR_EXTERNAL;
>          goto done;
>      }
> +
> +    if (ctx->cinema_mode == OPJ_CINEMA2K_24 || ctx->profile ==
> OPJ_CINEMA2K) {
> +        const char* options[4] = { NULL, NULL };
> +        char szGuardBits[32];
> +        int guard_bits = 1;
> +        sprintf(szGuardBits, "GUARD_BITS=%d", guard_bits);
> +        options[0] = szGuardBits;
> +
> +        opj_encoder_set_extra_options(compress, options);
> +    }
> +
>      stream = opj_stream_default_create(OPJ_STREAM_WRITE);
>
>      if (!stream) {
> --
> 2.39.3 (Apple Git-146)
>
diff mbox series

Patch

diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index 06937cb9cac..ee2513d2a38 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -691,6 +691,17 @@  static int
libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         ret = AVERROR_EXTERNAL;
         goto done;
     }
+
+    if (ctx->cinema_mode == OPJ_CINEMA2K_24 || ctx->profile == OPJ_CINEMA2K) {
+        const char* options[4] = { NULL, NULL };
+        char szGuardBits[32];
+        int guard_bits = 1;
+        sprintf(szGuardBits, "GUARD_BITS=%d", guard_bits);
+        options[0] = szGuardBits;
+
+        opj_encoder_set_extra_options(compress, options);
+    }
+
     stream = opj_stream_default_create(OPJ_STREAM_WRITE);