[FFmpeg-devel] [PATCH 10/10] avcodec/speedhq: Make speedhq_vlc const
Michael Niedermayer
michael at niedermayer.cc
Wed Sep 19 19:05:32 EEST 2018
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/speedhq.c | 73 +++++++++++++++++++++-----------------------
1 file changed, 34 insertions(+), 39 deletions(-)
diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c
index 6d3487ca19..890b8253cd 100644
--- a/libavcodec/speedhq.c
+++ b/libavcodec/speedhq.c
@@ -58,40 +58,40 @@ typedef struct SHQContext {
/* AC codes: Very similar but not identical to MPEG-2. */
-static uint16_t speedhq_vlc[123][2] = {
- {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5},
- {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7},
- {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8},
- {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14},
- {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14},
- {0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14},
- {0x16,14}, {0x15,14}, {0x14,14}, {0x13,14},
- {0x12,14}, {0x11,14}, {0x10,14}, {0x18,15},
- {0x17,15}, {0x16,15}, {0x15,15}, {0x14,15},
- {0x13,15}, {0x12,15}, {0x11,15}, {0x10,15},
- {0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8},
- {0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15},
- {0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15},
- {0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16},
- {0x11,16}, {0x10,16}, {0x18,13}, {0x17,13},
- {0x05, 5}, {0x07, 7}, {0xfc, 8}, {0x0c,10},
- {0x14,13}, {0x18,12}, {0x14,12}, {0x13,12},
- {0x10,12}, {0x1a,13}, {0x19,13}, {0x07, 5},
- {0x26, 8}, {0x1c,12}, {0x13,13}, {0x1b,12},
- {0x06, 6}, {0xfd, 8}, {0x12,12}, {0x1d,12},
- {0x07, 6}, {0x04, 9}, {0x12,13}, {0x06, 7},
- {0x1e,12}, {0x14,16}, {0x04, 7}, {0x15,12},
- {0x05, 7}, {0x11,12}, {0x78, 7}, {0x11,13},
- {0x7a, 7}, {0x10,13}, {0x21, 8}, {0x1a,16},
- {0x25, 8}, {0x19,16}, {0x24, 8}, {0x18,16},
- {0x05, 9}, {0x17,16}, {0x07, 9}, {0x16,16},
- {0x0d,10}, {0x15,16}, {0x1f,12}, {0x1a,12},
- {0x19,12}, {0x17,12}, {0x16,12}, {0x1f,13},
- {0x1e,13}, {0x1d,13}, {0x1c,13}, {0x1b,13},
- {0x1f,16}, {0x1e,16}, {0x1d,16}, {0x1c,16},
- {0x1b,16},
- {0x01,6}, /* escape */
- {0x06,4}, /* EOB */
+static const uint16_t speedhq_vlc[123][2] = {
+ {0x0001, 2}, {0x0003, 3}, {0x000E, 4}, {0x0007, 5},
+ {0x0017, 5}, {0x0028, 6}, {0x0008, 6}, {0x006F, 7},
+ {0x001F, 7}, {0x00C4, 8}, {0x0044, 8}, {0x005F, 8},
+ {0x00DF, 8}, {0x007F, 8}, {0x00FF, 8}, {0x3E00, 14},
+ {0x1E00, 14}, {0x2E00, 14}, {0x0E00, 14}, {0x3600, 14},
+ {0x1600, 14}, {0x2600, 14}, {0x0600, 14}, {0x3A00, 14},
+ {0x1A00, 14}, {0x2A00, 14}, {0x0A00, 14}, {0x3200, 14},
+ {0x1200, 14}, {0x2200, 14}, {0x0200, 14}, {0x0C00, 15},
+ {0x7400, 15}, {0x3400, 15}, {0x5400, 15}, {0x1400, 15},
+ {0x6400, 15}, {0x2400, 15}, {0x4400, 15}, {0x0400, 15},
+ {0x0002, 3}, {0x000C, 5}, {0x004F, 7}, {0x00E4, 8},
+ {0x0004, 8}, {0x0D00, 13}, {0x1500, 13}, {0x7C00, 15},
+ {0x3C00, 15}, {0x5C00, 15}, {0x1C00, 15}, {0x6C00, 15},
+ {0x2C00, 15}, {0x4C00, 15}, {0xC800, 16}, {0x4800, 16},
+ {0x8800, 16}, {0x0800, 16}, {0x0300, 13}, {0x1D00, 13},
+ {0x0014, 5}, {0x0070, 7}, {0x003F, 8}, {0x00C0, 10},
+ {0x0500, 13}, {0x0180, 12}, {0x0280, 12}, {0x0C80, 12},
+ {0x0080, 12}, {0x0B00, 13}, {0x1300, 13}, {0x001C, 5},
+ {0x0064, 8}, {0x0380, 12}, {0x1900, 13}, {0x0D80, 12},
+ {0x0018, 6}, {0x00BF, 8}, {0x0480, 12}, {0x0B80, 12},
+ {0x0038, 6}, {0x0040, 9}, {0x0900, 13}, {0x0030, 7},
+ {0x0780, 12}, {0x2800, 16}, {0x0010, 7}, {0x0A80, 12},
+ {0x0050, 7}, {0x0880, 12}, {0x000F, 7}, {0x1100, 13},
+ {0x002F, 7}, {0x0100, 13}, {0x0084, 8}, {0x5800, 16},
+ {0x00A4, 8}, {0x9800, 16}, {0x0024, 8}, {0x1800, 16},
+ {0x0140, 9}, {0xE800, 16}, {0x01C0, 9}, {0x6800, 16},
+ {0x02C0, 10}, {0xA800, 16}, {0x0F80, 12}, {0x0580, 12},
+ {0x0980, 12}, {0x0E80, 12}, {0x0680, 12}, {0x1F00, 13},
+ {0x0F00, 13}, {0x1700, 13}, {0x0700, 13}, {0x1B00, 13},
+ {0xF800, 16}, {0x7800, 16}, {0xB800, 16}, {0x3800, 16},
+ {0xD800, 16},
+ {0x0020, 6}, /* escape */
+ {0x0006, 4} /* EOB */
};
static const uint8_t speedhq_level[121] = {
@@ -580,7 +580,6 @@ static av_cold void speedhq_static_init(void)
{
uint16_t ff_mpeg12_vlc_dc_lum_code_reversed[12];
uint16_t ff_mpeg12_vlc_dc_chroma_code_reversed[12];
- int i;
/* Exactly the same as MPEG-2, except little-endian. */
reverse_code(ff_mpeg12_vlc_dc_lum_code,
@@ -598,10 +597,6 @@ static av_cold void speedhq_static_init(void)
ff_mpeg12_vlc_dc_chroma_bits, 1, 1,
ff_mpeg12_vlc_dc_chroma_code_reversed, 2, 2, 514);
- /* Reverse the AC VLC, because INIT_VLC_LE wants it in that order. */
- for (i = 0; i < FF_ARRAY_ELEMS(speedhq_vlc); ++i) {
- speedhq_vlc[i][0] = reverse(speedhq_vlc[i][0], speedhq_vlc[i][1]);
- }
ff_rl_init(&ff_rl_speedhq, ff_speedhq_static_rl_table_store);
INIT_2D_VLC_RL(ff_rl_speedhq, 674, INIT_VLC_LE);
--
2.19.0
More information about the ffmpeg-devel
mailing list