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
166 /* Read probabilities from bitstream */166 /* Read probabilities from bitstream */
167 for (i = 1; i < 257; i++) {167 for (i = 1; i < 257; i++) {
168 if (lag_decode_prob(gb, &rac->prob[i]) < 0) {168 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");
170 return AVERROR_INVALIDDATA;170 return AVERROR_INVALIDDATA;
171 }171 }
172 if ((uint64_t)cumul_prob + rac->prob[i] > UINT_MAX) {172 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");
174 return AVERROR_INVALIDDATA;174 return AVERROR_INVALIDDATA;
175 }175 }
176 cumul_prob += rac->prob[i];176 cumul_prob += rac->prob[i];
177 if (!rac->prob[i]) {177 if (!rac->prob[i]) {
178 if (lag_decode_prob(gb, &prob)) {178 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");
180 return AVERROR_INVALIDDATA;180 return AVERROR_INVALIDDATA;
181 }181 }
182 if (prob > 256 - i)182 if (prob > 256 - i)
@@ -189,7 +189,7 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb) · 6 unmodified lines
189 }189 }
190 190
191 if (!cumul_prob) {191 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");
193 return AVERROR_INVALIDDATA;193 return AVERROR_INVALIDDATA;
194 }194 }
195 195
@@ -207,7 +207,7 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb) · 11 unmodified lines
207 scaled_cumul_prob += rac->prob[i];207 scaled_cumul_prob += rac->prob[i];
208 }208 }
209 if (scaled_cumul_prob <= 0) {209 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");
211 return AVERROR_INVALIDDATA;211 return AVERROR_INVALIDDATA;
212 }212 }
213 for (; i < 257; i++) {213 for (; i < 257; i++) {
@@ -221,7 +221,7 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb) · 7 unmodified lines
221 cumulative_target = 1U << scale_factor;221 cumulative_target = 1U << scale_factor;
222 222
223 if (scaled_cumul_prob > cumulative_target) {223 if (scaled_cumul_prob > cumulative_target) {
224 av_log(rac->avctx, AV_LOG_ERROR,224 av_log(rac->logctx, AV_LOG_ERROR,
225 "Scaled probabilities are larger than target!\n");225 "Scaled probabilities are larger than target!\n");
226 return AVERROR_INVALIDDATA;226 return AVERROR_INVALIDDATA;
227 }227 }
@@ -463,7 +463,7 @@ static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst, · 235 unmodified lines
463 const uint8_t *src_end = src + src_size;463 const uint8_t *src_end = src + src_size;
464 int ret;464 int ret;
465 465
466 rac.avctx = l->avctx;466 rac.logctx = l->avctx;
467 l->zeros = 0;467 l->zeros = 0;
468 468
469 if(src_size < 2)469 if(src_size < 2)
libavcodec/lagarithrac.h+1−2
@@ -32,11 +32,10 @@ · 31 unmodified lines
32 32
33#include <stdint.h>33#include <stdint.h>
34#include "libavutil/intreadwrite.h"34#include "libavutil/intreadwrite.h"
35#include "avcodec.h"
36#include "get_bits.h"35#include "get_bits.h"
37 36
38typedef struct lag_rac {37typedef struct lag_rac {
39 AVCodecContext *avctx;38 void *logctx;
40 unsigned low;39 unsigned low;
41 unsigned range;40 unsigned range;
42 unsigned scale; /**< Number of bits of precision in range. */41 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