You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/proresdec: Don't use LONG_BITSTREAM_READER
Using LONG_BITSTREAM_READER means that every get_bits() call uses an AV_RB64() to ensure that cache always contains 32 valid bits (as opposed to the ordinary 25 guaranteed by reading 32 bits); yet this is unnecessary when unpacking alpha. So only use these 64bit reads where necessary. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -26,8 +26,6 @@
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
#define LONG_BITSTREAM_READER
|
||||
|
||||
#include "config_components.h"
|
||||
|
||||
#include "libavutil/internal.h"
|
||||
@ -428,7 +426,7 @@ static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, cons
|
||||
unsigned int rice_order, exp_order, switch_bits; \
|
||||
unsigned int q, buf, bits; \
|
||||
\
|
||||
UPDATE_CACHE(re, gb); \
|
||||
UPDATE_CACHE_32(re, gb); /* We really need 32 bits */ \
|
||||
buf = GET_CACHE(re, gb); \
|
||||
\
|
||||
/* number of bits to switch between rice and exp golomb */ \
|
||||
@ -440,7 +438,7 @@ static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, cons
|
||||
\
|
||||
if (q > switch_bits) { /* exp golomb */ \
|
||||
bits = exp_order - switch_bits + (q<<1); \
|
||||
if (bits > FFMIN(MIN_CACHE_BITS, 31)) \
|
||||
if (bits > 31) \
|
||||
return AVERROR_INVALIDDATA; \
|
||||
val = SHOW_UBITS(re, gb, bits) - (1 << exp_order) + \
|
||||
((switch_bits + 1) << rice_order); \
|
||||
@ -502,7 +500,7 @@ static av_always_inline int decode_ac_coeffs(AVCodecContext *avctx, GetBitContex
|
||||
int log2_block_count = av_log2(blocks_per_slice);
|
||||
|
||||
OPEN_READER(re, gb);
|
||||
UPDATE_CACHE(re, gb); \
|
||||
UPDATE_CACHE_32(re, gb);
|
||||
run = 4;
|
||||
level = 2;
|
||||
|
||||
|
Reference in New Issue
Block a user