Christophe Gisquet
christophe.gisquet at gmail.com
Fri Sep 8 11:15:02 EEST 2023
- Previous message (by thread): [FFmpeg-devel] [PATCH v4 2/2] lavc/videotoolboxenc: Get the encoder supported properties
- Next message (by thread): [FFmpeg-devel] [PATCH 2/7] proresdec2: store precomputed EC parameters
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Summary of changes - move back to regular, non-macro, get_bits API - reduce the lookup to switch the coding method - shorter reads wherever possible, in particular for the end of bitstream (16 bits instead of 32, as per the above) There are cases that really need longer lengths (larger EG codes) of up to 27 bits. Win64: 6.10 -> 4.87 (~20% speedup) Reference for an hypothetical 32bits version of the cached reader: Win32: 11.4 -> 9.8 (14%, because iDCT is not SIMDed) --- libavcodec/proresdec2.c | 53 ++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index 9297860946..6e243cfc17 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -24,9 +24,7 @@ * Known FOURCCs: 'apch' (HQ), 'apcn' (SD), 'apcs' (LT), 'apco' (Proxy), 'ap4h' (4444), 'ap4x' (4444 XQ) */ -//#define DEBUG - -#define LONG_BITSTREAM_READER +#define CACHED_BITSTREAM_READER 1 #include "config_components.h" @@ -422,35 +420,37 @@ static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, cons return pic_data_size; } -#define DECODE_CODEWORD(val, codebook, SKIP) +/* bitstream_read may fail on 32bits ARCHS for >24 bits, so use long version there */ +#if 0 //BITSTREAM_BITS == 32 +# define READ_BITS get_bits_long +#else +# define READ_BITS get_bits +#endif + +#define DECODE_CODEWORD(val, codebook) do { unsigned int rice_order, exp_order, switch_bits; unsigned int q, buf, bits;