[FFmpeg-cvslog] avcodec/exr: unbreak parsing sample aspect ratio

Paul B Mahol git at videolan.org
Mon Feb 15 18:40:55 EET 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Feb 15 17:37:25 2021 +0100| [5f0e3b549a26d7dae66dcaf278dd4abf0ba69b07] | committer: Paul B Mahol

avcodec/exr: unbreak parsing sample aspect ratio

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

 libavcodec/exr.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index ef14bfd69a..d94291ce73 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -134,6 +134,7 @@ typedef struct EXRContext {
     const AVPixFmtDescriptor *desc;
 
     int w, h;
+    uint32_t sar;
     int32_t xmax, xmin;
     int32_t ymax, ymin;
     uint32_t xdelta, ydelta;
@@ -1309,7 +1310,7 @@ static int check_header_variable(EXRContext *s,
 static int decode_header(EXRContext *s, AVFrame *frame)
 {
     AVDictionary *metadata = NULL;
-    int magic_number, version, i, flags, sar = 0;
+    int magic_number, version, i, flags;
     int layer_match = 0;
     int ret;
     int dup_channels = 0;
@@ -1580,7 +1581,7 @@ static int decode_header(EXRContext *s, AVFrame *frame)
                 goto fail;
             }
 
-            sar = bytestream2_get_le32(&s->gb);
+            s->sar = bytestream2_get_le32(&s->gb);
 
             continue;
         } else if ((var_size = check_header_variable(s, "compression",
@@ -1663,8 +1664,6 @@ static int decode_header(EXRContext *s, AVFrame *frame)
         bytestream2_skip(&s->gb, bytestream2_get_le32(&s->gb));
     }
 
-    ff_set_sar(s->avctx, av_d2q(av_int2float(sar), 255));
-
     if (s->compression == EXR_UNKN) {
         av_log(s->avctx, AV_LOG_ERROR, "Missing compression attribute.\n");
         ret = AVERROR_INVALIDDATA;
@@ -1788,6 +1787,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
     if ((ret = ff_set_dimensions(avctx, s->w, s->h)) < 0)
         return ret;
 
+    ff_set_sar(s->avctx, av_d2q(av_int2float(s->sar), 255));
+
     s->desc          = av_pix_fmt_desc_get(avctx->pix_fmt);
     if (!s->desc)
         return AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list