History

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

Andreas Rheinhardt committed 3 years ago

Commit 3ea73bc1 parent 08dd0362 files · +8 −9Browse files

Unified · Split

2 files
  1. libavcodec/lagarith.c +7 −7
  2. libavcodec/lagarithrac.h +1 −2
libavcodec/lagarith.c+7−7
@@ -166,17 +166,17 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb) · 165 unmodified lines
166166 /* Read probabilities from bitstream */
167167 for (i = 1; i < 257; i++) {
168168 if (lag_decode_prob(gb, &rac->prob[i]) < 0) {
169− av_log(rac->avctx, AV_LOG_ERROR, "Invalid probability encountered.\n");
169+ av_log(rac->logctx, AV_LOG_ERROR, "Invalid probability encountered.\n");
170170 return AVERROR_INVALIDDATA;
171171 }
172172 if ((uint64_t)cumul_prob + rac->prob[i] > UINT_MAX) {
173− av_log(rac->avctx, AV_LOG_ERROR, "Integer overflow encountered in cumulative probability calculation.\n");
173+ av_log(rac->logctx, AV_LOG_ERROR, "Integer overflow encountered in cumulative probability calculation.\n");
174174 return AVERROR_INVALIDDATA;
175175 }
176176 cumul_prob += rac->prob[i];
177177 if (!rac->prob[i]) {
178178 if (lag_decode_prob(gb, &prob)) {
179− av_log(rac->avctx, AV_LOG_ERROR, "Invalid probability run encountered.\n");
179+ av_log(rac->logctx, AV_LOG_ERROR, "Invalid probability run encountered.\n");
180180 return AVERROR_INVALIDDATA;
181181 }
182182 if (prob > 256 - i)
@@ -189,7 +189,7 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb) · 6 unmodified lines
189189 }
190190
191191 if (!cumul_prob) {
192− av_log(rac->avctx, AV_LOG_ERROR, "All probabilities are 0!\n");
192+ av_log(rac->logctx, AV_LOG_ERROR, "All probabilities are 0!\n");
193193 return AVERROR_INVALIDDATA;
194194 }
195195
@@ -207,7 +207,7 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb) · 11 unmodified lines
207207 scaled_cumul_prob += rac->prob[i];
208208 }
209209 if (scaled_cumul_prob <= 0) {
210− av_log(rac->avctx, AV_LOG_ERROR, "Scaled probabilities invalid\n");
210+ av_log(rac->logctx, AV_LOG_ERROR, "Scaled probabilities invalid\n");
211211 return AVERROR_INVALIDDATA;
212212 }
213213 for (; i < 257; i++) {
@@ -221,7 +221,7 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb) · 7 unmodified lines
221221 cumulative_target = 1U << scale_factor;
222222
223223 if (scaled_cumul_prob > cumulative_target) {
224− av_log(rac->avctx, AV_LOG_ERROR,
224+ av_log(rac->logctx, AV_LOG_ERROR,
225225 "Scaled probabilities are larger than target!\n");
226226 return AVERROR_INVALIDDATA;
227227 }
@@ -463,7 +463,7 @@ static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst, · 235 unmodified lines
463463 const uint8_t *src_end = src + src_size;
464464 int ret;
465465
466− rac.avctx = l->avctx;
466+ rac.logctx = l->avctx;
467467 l->zeros = 0;
468468
469469 if(src_size < 2)
libavcodec/lagarithrac.h+1−2
@@ -32,11 +32,10 @@ · 31 unmodified lines
3232
3333 #include <stdint.h>
3434 #include "libavutil/intreadwrite.h"
35−#include "avcodec.h"
3635 #include "get_bits.h"
3736
3837 typedef struct lag_rac {
39− AVCodecContext *avctx;
38+ void *logctx;
4039 unsigned low;
4140 unsigned range;
4241 unsigned scale; /**< Number of bits of precision in range. */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t