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

Marc-Antoine ARNAUD marc-antoine.arnaud at luminvent.com
Thu Nov 7 15:06:47 EET 2024


Signed-off-by: Marc-Antoine Arnaud <marc-antoine.arnaud at 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)


More information about the ffmpeg-devel mailing list