History

avcodec/vqcdec: Avoid unnecessary VLC structure

Everything besides VLC.table is basically write-only and even VLC.table can be removed by accessing the underlying table directly.

Andreas Rheinhardt committed 3 years ago

Commit 36e7f9b1 parent 99ed5101 file · +7 −6Browse files

Unified · Split

libavcodec/vqcdec.c+7−6
@@ -49,14 +49,15 @@ static const int8_t vector_symbols[] = { · 48 unmodified lines
4949 2, 3, 4, SIGNED_8BIT, -2, -3, -4, SIGNED_6BIT
5050 };
5151
52−static VLC vector_vlc;
52+static VLCElem vector_vlc[1 << VECTOR_VLC_BITS];
5353
5454 static av_cold void vqc_init_static_data(void)
5555 {
56− VLC_INIT_STATIC_FROM_LENGTHS(&vector_vlc, VECTOR_VLC_BITS, FF_ARRAY_ELEMS(vector_nbits),
57− vector_nbits, 1,
58− vector_symbols, 1, 1,
59− 0, 0, 1 << VECTOR_VLC_BITS);
56+ VLC_INIT_STATIC_TABLE_FROM_LENGTHS(vector_vlc, VECTOR_VLC_BITS,
57+ FF_ARRAY_ELEMS(vector_nbits),
58+ vector_nbits, 1,
59+ vector_symbols, 1, 1,
60+ 0, 0);
6061 }
6162
6263 typedef struct VqcContext {
@@ -171,7 +172,7 @@ static int decode_vectors(VqcContext * s, const uint8_t * buf, int size, int wid · 108 unmodified lines
171172 continue;
172173 }
173174
174− symbol = get_vlc2(&gb, vector_vlc.table, VECTOR_VLC_BITS, 1);
175+ symbol = get_vlc2(&gb, vector_vlc, VECTOR_VLC_BITS, 1);
175176 switch(symbol) {
176177 case SKIP_3: dst += 3; break;
177178 case SKIP_4: dst += 4; break;

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