[FFmpeg-cvslog] avcodec/exrenc: add grayf32 format support

Paul B Mahol git at videolan.org
Thu Jun 30 16:08:17 EEST 2022


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Jun 30 15:04:24 2022 +0200| [3f72155fc664b6abccd194d71cbec44183ab64d9] | committer: Paul B Mahol

avcodec/exrenc: add grayf32 format support

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f72155fc664b6abccd194d71cbec44183ab64d9
---

 libavcodec/exrenc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/exrenc.c b/libavcodec/exrenc.c
index 459afebb82..9138684bcb 100644
--- a/libavcodec/exrenc.c
+++ b/libavcodec/exrenc.c
@@ -54,8 +54,10 @@ enum ExrPixelType {
 
 static const char abgr_chlist[4] = { 'A', 'B', 'G', 'R' };
 static const char bgr_chlist[4] = { 'B', 'G', 'R', 'A' };
+static const char y_chlist[4] = { 'Y' };
 static const uint8_t gbra_order[4] = { 3, 1, 0, 2 };
 static const uint8_t gbr_order[4] = { 1, 0, 2, 0 };
+static const uint8_t y_order[4] = { 0 };
 
 typedef struct EXRScanlineData {
     uint8_t *compressed_data;
@@ -106,6 +108,11 @@ static int encode_init(AVCodecContext *avctx)
         s->ch_names = abgr_chlist;
         s->ch_order = gbra_order;
         break;
+    case AV_PIX_FMT_GRAYF32:
+        s->planes = 1;
+        s->ch_names = y_chlist;
+        s->ch_order = y_order;
+        break;
     default:
         av_assert0(0);
     }
@@ -546,6 +553,7 @@ const FFCodec ff_exr_encoder = {
     FF_CODEC_ENCODE_CB(encode_frame),
     .close          = encode_close,
     .p.pix_fmts     = (const enum AVPixelFormat[]) {
+                                                 AV_PIX_FMT_GRAYF32,
                                                  AV_PIX_FMT_GBRPF32,
                                                  AV_PIX_FMT_GBRAPF32,
                                                  AV_PIX_FMT_NONE },



More information about the ffmpeg-cvslog mailing list