PR #20988 opened by dkozinski
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20988
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20988.patch

- Replaced direct assignments with 'av_be2ne16' and 'av_be2ne32' for byte order 
conversion in 'apv_decode_metadata'

Signed-off-by: Dawid Kozinski <[email protected]>


>From 8c3c83104ddb94649df144bc7c37cb6167482134 Mon Sep 17 00:00:00 2001
From: Dawid Kozinski <[email protected]>
Date: Fri, 21 Nov 2025 09:52:46 +0100
Subject: [PATCH] avcodec/apv_decode: Update metadata decoding to use byte
 order conversion functions

- Replaced direct assignments with 'av_be2ne16' and 'av_be2ne32' for byte order 
conversion in 'apv_decode_metadata'

Signed-off-by: Dawid Kozinski <[email protected]>
---
 libavcodec/apv_decode.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/apv_decode.c b/libavcodec/apv_decode.c
index dbe354a793..ca3fc5896e 100644
--- a/libavcodec/apv_decode.c
+++ b/libavcodec/apv_decode.c
@@ -408,7 +408,7 @@ static int apv_decode_metadata(AVCodecContext *avctx, 
AVFrame *frame,
         const APVRawMetadataPayload *pl = &md->payloads[i];
 
         switch (pl->payload_type) {
-        case APV_METADATA_MDCV:
+             case APV_METADATA_MDCV:
             {
                 const APVRawMetadataMDCV *mdcv = &pl->mdcv;
                 AVMasteringDisplayMetadata *mdm;
@@ -420,20 +420,20 @@ static int apv_decode_metadata(AVCodecContext *avctx, 
AVFrame *frame,
                 if (mdm) {
                     for (int j = 0; j < 3; j++) {
                         mdm->display_primaries[j][0] =
-                            av_make_q(mdcv->primary_chromaticity_x[j], 1 << 
16);
+                            
av_make_q(av_be2ne16(mdcv->primary_chromaticity_x[j]), 1 << 16);
                         mdm->display_primaries[j][1] =
-                            av_make_q(mdcv->primary_chromaticity_y[j], 1 << 
16);
+                            
av_make_q(av_be2ne16(mdcv->primary_chromaticity_y[j]), 1 << 16);
                     }
 
                     mdm->white_point[0] =
-                        av_make_q(mdcv->white_point_chromaticity_x, 1 << 16);
+                        
av_make_q(av_be2ne16(mdcv->white_point_chromaticity_x), 1 << 16);
                     mdm->white_point[1] =
-                        av_make_q(mdcv->white_point_chromaticity_y, 1 << 16);
+                        
av_make_q(av_be2ne16(mdcv->white_point_chromaticity_y), 1 << 16);
 
                     mdm->max_luminance =
-                        av_make_q(mdcv->max_mastering_luminance, 1 << 8);
+                        av_make_q(av_be2ne32(mdcv->max_mastering_luminance), 1 
<< 8);
                     mdm->min_luminance =
-                        av_make_q(mdcv->min_mastering_luminance, 1 << 14);
+                        av_make_q(av_be2ne32(mdcv->min_mastering_luminance), 1 
<< 14);
 
                     mdm->has_primaries = 1;
                     mdm->has_luminance = 1;
@@ -450,8 +450,8 @@ static int apv_decode_metadata(AVCodecContext *avctx, 
AVFrame *frame,
                     return err;
 
                 if (clm) {
-                    clm->MaxCLL  = cll->max_cll;
-                    clm->MaxFALL = cll->max_fall;
+                    clm->MaxCLL  = av_be2ne16(cll->max_cll);
+                    clm->MaxFALL = av_be2ne16(cll->max_fall);
                 }
             }
             break;
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to