[FFmpeg-cvslog] avcodec/lagarith: Use void* instead of AVCodecContext* as logctx

Andreas Rheinhardt git at videolan.org
Sun Oct 1 02:11:53 EEST 2023


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Sep 28 21:48:04 2023 +0200| [3ea73bc78a8b43abbb58b47de96cac07c06d0a20] | committer: Andreas Rheinhardt

avcodec/lagarith: Use void* instead of AVCodecContext* as logctx

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/lagarith.c    | 14 +++++++-------
 libavcodec/lagarithrac.h |  3 +--
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index 3288c0517c..9574f78871 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -166,17 +166,17 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb)
     /* Read probabilities from bitstream */
     for (i = 1; i < 257; i++) {
         if (lag_decode_prob(gb, &rac->prob[i]) < 0) {
-            av_log(rac->avctx, AV_LOG_ERROR, "Invalid probability encountered.\n");
+            av_log(rac->logctx, AV_LOG_ERROR, "Invalid probability encountered.\n");
             return AVERROR_INVALIDDATA;
         }
         if ((uint64_t)cumul_prob + rac->prob[i] > UINT_MAX) {
-            av_log(rac->avctx, AV_LOG_ERROR, "Integer overflow encountered in cumulative probability calculation.\n");
+            av_log(rac->logctx, AV_LOG_ERROR, "Integer overflow encountered in cumulative probability calculation.\n");
             return AVERROR_INVALIDDATA;
         }
         cumul_prob += rac->prob[i];
         if (!rac->prob[i]) {
             if (lag_decode_prob(gb, &prob)) {
-                av_log(rac->avctx, AV_LOG_ERROR, "Invalid probability run encountered.\n");
+                av_log(rac->logctx, AV_LOG_ERROR, "Invalid probability run encountered.\n");
                 return AVERROR_INVALIDDATA;
             }
             if (prob > 256 - i)
@@ -189,7 +189,7 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb)
     }
 
     if (!cumul_prob) {
-        av_log(rac->avctx, AV_LOG_ERROR, "All probabilities are 0!\n");
+        av_log(rac->logctx, AV_LOG_ERROR, "All probabilities are 0!\n");
         return AVERROR_INVALIDDATA;
     }
 
@@ -207,7 +207,7 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb)
             scaled_cumul_prob += rac->prob[i];
         }
         if (scaled_cumul_prob <= 0) {
-            av_log(rac->avctx, AV_LOG_ERROR, "Scaled probabilities invalid\n");
+            av_log(rac->logctx, AV_LOG_ERROR, "Scaled probabilities invalid\n");
             return AVERROR_INVALIDDATA;
         }
         for (; i < 257; i++) {
@@ -221,7 +221,7 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb)
         cumulative_target = 1U << scale_factor;
 
         if (scaled_cumul_prob > cumulative_target) {
-            av_log(rac->avctx, AV_LOG_ERROR,
+            av_log(rac->logctx, AV_LOG_ERROR,
                    "Scaled probabilities are larger than target!\n");
             return AVERROR_INVALIDDATA;
         }
@@ -463,7 +463,7 @@ static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst,
     const uint8_t *src_end = src + src_size;
     int ret;
 
-    rac.avctx = l->avctx;
+    rac.logctx = l->avctx;
     l->zeros = 0;
 
     if(src_size < 2)
diff --git a/libavcodec/lagarithrac.h b/libavcodec/lagarithrac.h
index a31b054dbb..2c8cb7385a 100644
--- a/libavcodec/lagarithrac.h
+++ b/libavcodec/lagarithrac.h
@@ -32,11 +32,10 @@
 
 #include <stdint.h>
 #include "libavutil/intreadwrite.h"
-#include "avcodec.h"
 #include "get_bits.h"
 
 typedef struct lag_rac {
-    AVCodecContext *avctx;
+    void    *logctx;
     unsigned low;
     unsigned range;
     unsigned scale;             /**< Number of bits of precision in range. */



More information about the ffmpeg-cvslog mailing list