@@ -24,6 +24,8 @@
* RV40 decoder
*/
+#include "config.h"
+
#include "libavutil/imgutils.h"
#include "avcodec.h"
@@ -71,12 +73,21 @@ static av_cold void rv40_init_tables(void)
aic_mode1_vlc_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
}
for(i = 0; i < AIC_MODE2_NUM; i++){
+ uint16_t syms[AIC_MODE2_SIZE];
+
+ for (int j = 0; j < AIC_MODE2_SIZE; j++) {
+ int first = aic_mode2_vlc_syms[i][j] >> 4;
+ int second = aic_mode2_vlc_syms[i][j] & 0xF;
+ if (HAVE_BIGENDIAN)
+ syms[j] = (first << 8) | second;
+ else
+ syms[j] = first | (second << 8);
+ }
aic_mode2_vlc[i].table = &aic_mode2_table[mode2_offs[i]];
aic_mode2_vlc[i].table_allocated = mode2_offs[i + 1] - mode2_offs[i];
ff_init_vlc_from_lengths(&aic_mode2_vlc[i], AIC_MODE2_BITS, AIC_MODE2_SIZE,
aic_mode2_vlc_bits[i], 1,
- aic_mode2_vlc_syms[i], 1, 1,
- 0, INIT_VLC_USE_NEW_STATIC, NULL);
+ syms, 2, 2, 0, INIT_VLC_USE_NEW_STATIC, NULL);
}
for(i = 0; i < NUM_PTYPE_VLCS; i++){
ptype_vlc[i].table = &ptype_table[i << PTYPE_VLC_BITS];
@@ -195,9 +206,8 @@ static int rv40_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t
if(pattern == rv40_aic_table_index[k])
break;
if(j < 3 && k < MODE2_PATTERNS_NUM){ //pattern is found, decoding 2 coefficients
- v = get_vlc2(gb, aic_mode2_vlc[k].table, AIC_MODE2_BITS, 2);
- *ptr++ = v/9;
- *ptr++ = v%9;
+ AV_WN16(ptr, get_vlc2(gb, aic_mode2_vlc[k].table, AIC_MODE2_BITS, 2));
+ ptr += 2;
j++;
}else{
if(B != -1 && C != -1)
@@ -55,184 +55,184 @@ static const uint8_t rv40_aic_top_vlc_bits[AIC_TOP_SIZE] = {
static const uint8_t aic_mode2_vlc_syms[AIC_MODE2_NUM][AIC_MODE2_SIZE] = {
{
- 0x06, 0x01, 0x1A, 0x0A, 0x14, 0x12, 0x04, 0x07, 0x05, 0x0F, 0x08, 0x36,
- 0x02, 0x3C, 0x37, 0x15, 0x0E, 0x1C, 0x18, 0x46, 0x0B, 0x09, 0x26, 0x13,
- 0x41, 0x2D, 0x50, 0x4A, 0x19, 0x16, 0x28, 0x24, 0x38, 0x32, 0x11, 0x0C,
- 0x30, 0x2F, 0x3A, 0x2A, 0x25, 0x2E, 0x2B, 0x1E, 0x1D, 0x43, 0x3D, 0x0D,
- 0x03, 0x1B, 0x17, 0x21, 0x1F, 0x29, 0x22, 0x47, 0x4D, 0x4C, 0x44, 0x42,
- 0x34, 0x4E, 0x3B, 0x35, 0x40, 0x3E, 0x3F, 0x33, 0x31, 0x10, 0x45, 0x39,
- 0x4F, 0x49, 0x48, 0x23, 0x20, 0x2C, 0x27, 0x4B, 0x00,
- },
- {
- 0x46, 0x38, 0x2A, 0x1E, 0x3E, 0x2F, 0x11, 0x05, 0x1C, 0x17, 0x26, 0x04,
- 0x2E, 0x28, 0x24, 0x1D, 0x32, 0x25, 0x18, 0x16, 0x1B, 0x19, 0x34, 0x21,
- 0x4C, 0x45, 0x49, 0x4B, 0x47, 0x42, 0x29, 0x4D, 0x44, 0x4E, 0x4F, 0x33,
- 0x30, 0x48, 0x3D, 0x20, 0x1F, 0x27, 0x22, 0x4A, 0x3F, 0x3B, 0x43, 0x40,
- 0x31, 0x2C, 0x39, 0x35, 0x41, 0x3A, 0x07, 0x03, 0x2B, 0x23, 0x50, 0x12,
- 0x01, 0x36, 0x1A, 0x0F, 0x02, 0x37, 0x2D, 0x0C, 0x08, 0x15, 0x10, 0x3C,
- 0x0D, 0x06, 0x13, 0x0E, 0x09, 0x00, 0x14, 0x0B, 0x0A,
- },
- {
- 0x09, 0x01, 0x16, 0x0B, 0x50, 0x4B, 0x3F, 0x0D, 0x08, 0x2A, 0x17, 0x4F,
- 0x28, 0x26, 0x36, 0x2D, 0x37, 0x2E, 0x40, 0x3C, 0x0E, 0x04, 0x25, 0x1E,
- 0x10, 0x03, 0x1F, 0x11, 0x4E, 0x3E, 0x3D, 0x39, 0x34, 0x44, 0x3B, 0x29,
- 0x21, 0x35, 0x31, 0x27, 0x22, 0x33, 0x30, 0x43, 0x38, 0x4D, 0x47, 0x07,
- 0x05, 0x20, 0x0C, 0x4C, 0x3A, 0x32, 0x45, 0x42, 0x2B, 0x23, 0x2F, 0x2C,
- 0x0A, 0x00, 0x13, 0x12, 0x4A, 0x1A, 0x49, 0x48, 0x1C, 0x1B, 0x24, 0x1D,
- 0x0F, 0x06, 0x18, 0x15, 0x19, 0x02, 0x46, 0x41, 0x14,
- },
- {
- 0x50, 0x4A, 0x2D, 0x2B, 0x43, 0x27, 0x45, 0x44, 0x3E, 0x16, 0x00, 0x22,
- 0x1B, 0x31, 0x28, 0x3A, 0x35, 0x21, 0x1F, 0x3B, 0x24, 0x06, 0x03, 0x12,
- 0x10, 0x08, 0x04, 0x2C, 0x29, 0x4F, 0x4C, 0x40, 0x4D, 0x47, 0x48, 0x42,
- 0x07, 0x4E, 0x39, 0x34, 0x3F, 0x3D, 0x46, 0x41, 0x4B, 0x49, 0x1D, 0x1A,
- 0x11, 0x05, 0x26, 0x23, 0x2F, 0x0D, 0x02, 0x17, 0x15, 0x3C, 0x33, 0x30,
- 0x38, 0x36, 0x20, 0x1E, 0x2A, 0x25, 0x13, 0x0B, 0x09, 0x01, 0x18, 0x0C,
- 0x37, 0x14, 0x0F, 0x19, 0x0E, 0x32, 0x1C, 0x2E, 0x0A,
- },
- {
- 0x0C, 0x09, 0x19, 0x0D, 0x3C, 0x28, 0x25, 0x30, 0x2A, 0x17, 0x11, 0x20,
- 0x1E, 0x3E, 0x39, 0x50, 0x40, 0x1F, 0x16, 0x2D, 0x2B, 0x22, 0x08, 0x2C,
- 0x29, 0x4A, 0x43, 0x3F, 0x4C, 0x45, 0x1B, 0x04, 0x34, 0x27, 0x4B, 0x47,
- 0x4E, 0x4D, 0x42, 0x07, 0x48, 0x44, 0x4F, 0x3B, 0x33, 0x03, 0x00, 0x12,
- 0x06, 0x41, 0x2F, 0x1C, 0x38, 0x36, 0x13, 0x0E, 0x2E, 0x14, 0x0F, 0x0B,
- 0x02, 0x01, 0x15, 0x10, 0x32, 0x46, 0x3A, 0x35, 0x31, 0x49, 0x3D, 0x21,
- 0x05, 0x24, 0x23, 0x1A, 0x18, 0x26, 0x1D, 0x37, 0x0A,
- },
- {
- 0x14, 0x0A, 0x15, 0x0C, 0x1D, 0x17, 0x41, 0x29, 0x24, 0x34, 0x2D, 0x03,
- 0x00, 0x1B, 0x08, 0x4E, 0x44, 0x48, 0x3E, 0x27, 0x04, 0x2B, 0x07, 0x2C,
- 0x3B, 0x35, 0x4D, 0x4C, 0x47, 0x3A, 0x3D, 0x39, 0x43, 0x42, 0x06, 0x05,
- 0x28, 0x22, 0x4F, 0x4B, 0x2A, 0x26, 0x31, 0x30, 0x11, 0x10, 0x21, 0x1F,
- 0x3C, 0x32, 0x23, 0x16, 0x33, 0x25, 0x02, 0x01, 0x12, 0x0D, 0x0F, 0x0B,
- 0x37, 0x19, 0x18, 0x0E, 0x1C, 0x1A, 0x13, 0x50, 0x4A, 0x38, 0x36, 0x45,
- 0x3F, 0x1E, 0x09, 0x2F, 0x20, 0x40, 0x2E, 0x49, 0x46,
- },
- {
- 0x0F, 0x0B, 0x37, 0x14, 0x2E, 0x13, 0x0E, 0x2F, 0x1C, 0x32, 0x49, 0x3C,
- 0x2A, 0x26, 0x38, 0x31, 0x0D, 0x01, 0x17, 0x15, 0x19, 0x0C, 0x33, 0x25,
- 0x20, 0x1E, 0x35, 0x30, 0x18, 0x09, 0x1D, 0x1A, 0x4C, 0x46, 0x27, 0x00,
- 0x3E, 0x2B, 0x4D, 0x29, 0x1F, 0x34, 0x2D, 0x05, 0x03, 0x22, 0x1B, 0x4F,
- 0x4E, 0x45, 0x08, 0x07, 0x48, 0x44, 0x3F, 0x42, 0x04, 0x47, 0x43, 0x39,
- 0x2C, 0x40, 0x3D, 0x4A, 0x3B, 0x10, 0x06, 0x16, 0x12, 0x50, 0x4B, 0x36,
- 0x28, 0x24, 0x41, 0x3A, 0x11, 0x02, 0x23, 0x21, 0x0A,
- },
- {
- 0x3C, 0x01, 0x0D, 0x03, 0x16, 0x15, 0x38, 0x08, 0x04, 0x20, 0x12, 0x41,
- 0x39, 0x35, 0x3F, 0x3E, 0x2C, 0x29, 0x31, 0x30, 0x18, 0x17, 0x3B, 0x28,
- 0x0C, 0x05, 0x2E, 0x25, 0x37, 0x0F, 0x0B, 0x09, 0x06, 0x1A, 0x19, 0x36,
- 0x24, 0x1D, 0x33, 0x2F, 0x10, 0x00, 0x1C, 0x11, 0x42, 0x1B, 0x44, 0x43,
- 0x50, 0x4C, 0x4B, 0x4E, 0x48, 0x4D, 0x27, 0x23, 0x4F, 0x2B, 0x45, 0x40,
- 0x2D, 0x22, 0x47, 0x34, 0x4A, 0x46, 0x3D, 0x1E, 0x07, 0x21, 0x1F, 0x49,
- 0x2A, 0x26, 0x3A, 0x32, 0x0E, 0x02, 0x14, 0x13, 0x0A,
- },
- {
- 0x14, 0x00, 0x0A, 0x01, 0x12, 0x08, 0x50, 0x38, 0x19, 0x02, 0x07, 0x06,
- 0x13, 0x0B, 0x1A, 0x4F, 0x3C, 0x1D, 0x1B, 0x23, 0x1E, 0x0E, 0x0D, 0x17,
- 0x10, 0x18, 0x16, 0x36, 0x26, 0x47, 0x40, 0x4C, 0x49, 0x28, 0x15, 0x2F,
- 0x2D, 0x48, 0x3F, 0x20, 0x0C, 0x2C, 0x2A, 0x4B, 0x2E, 0x24, 0x3A, 0x37,
- 0x32, 0x2B, 0x43, 0x35, 0x11, 0x03, 0x25, 0x1C, 0x42, 0x3E, 0x27, 0x21,
- 0x34, 0x29, 0x4D, 0x33, 0x31, 0x3D, 0x3B, 0x45, 0x44, 0x22, 0x1F, 0x39,
- 0x30, 0x4E, 0x46, 0x41, 0x05, 0x04, 0x0F, 0x09, 0x4A,
- },
- {
- 0x14, 0x0B, 0x19, 0x13, 0x0D, 0x01, 0x12, 0x0E, 0x38, 0x02, 0x00, 0x0F,
- 0x09, 0x36, 0x10, 0x41, 0x3C, 0x1A, 0x07, 0x06, 0x11, 0x0C, 0x4A, 0x32,
- 0x24, 0x47, 0x40, 0x17, 0x15, 0x1D, 0x1C, 0x26, 0x18, 0x37, 0x2F, 0x16,
- 0x08, 0x2D, 0x28, 0x46, 0x22, 0x1F, 0x39, 0x34, 0x4F, 0x4C, 0x48, 0x4E,
- 0x4B, 0x29, 0x21, 0x4D, 0x42, 0x3F, 0x3E, 0x49, 0x43, 0x1E, 0x03, 0x23,
- 0x20, 0x50, 0x33, 0x31, 0x45, 0x44, 0x2A, 0x27, 0x30, 0x2C, 0x3A, 0x2E,
- 0x35, 0x2B, 0x3D, 0x3B, 0x05, 0x04, 0x25, 0x1B, 0x0A,
- },
- {
- 0x28, 0x24, 0x3C, 0x36, 0x15, 0x0F, 0x1D, 0x1B, 0x07, 0x06, 0x11, 0x0D,
- 0x4E, 0x2D, 0x2B, 0x44, 0x32, 0x1E, 0x1C, 0x25, 0x20, 0x48, 0x3F, 0x4C,
- 0x4B, 0x47, 0x40, 0x4F, 0x49, 0x46, 0x0B, 0x23, 0x17, 0x2F, 0x2E, 0x08,
- 0x01, 0x10, 0x0E, 0x35, 0x31, 0x3E, 0x3D, 0x1F, 0x0C, 0x2C, 0x2A, 0x04,
- 0x03, 0x21, 0x05, 0x4D, 0x33, 0x29, 0x3B, 0x34, 0x42, 0x27, 0x22, 0x39,
- 0x30, 0x3A, 0x37, 0x45, 0x43, 0x16, 0x09, 0x38, 0x26, 0x13, 0x0A, 0x02,
- 0x00, 0x18, 0x12, 0x50, 0x1A, 0x19, 0x4A, 0x41, 0x14,
- },
- {
- 0x1A, 0x19, 0x40, 0x3F, 0x4F, 0x47, 0x4A, 0x14, 0x46, 0x41, 0x07, 0x01,
- 0x0D, 0x08, 0x49, 0x3C, 0x38, 0x48, 0x44, 0x24, 0x17, 0x2E, 0x2D, 0x02,
- 0x00, 0x18, 0x12, 0x26, 0x16, 0x2F, 0x28, 0x0F, 0x09, 0x15, 0x10, 0x3A,
- 0x36, 0x4E, 0x4B, 0x2A, 0x25, 0x32, 0x31, 0x2C, 0x2B, 0x35, 0x33, 0x11,
- 0x04, 0x20, 0x1C, 0x34, 0x23, 0x1F, 0x03, 0x39, 0x30, 0x3D, 0x0C, 0x05,
- 0x21, 0x1E, 0x42, 0x37, 0x27, 0x22, 0x3E, 0x3B, 0x29, 0x4D, 0x45, 0x43,
- 0x0E, 0x06, 0x1D, 0x1B, 0x4C, 0x0B, 0x0A, 0x50, 0x13,
- },
- {
- 0x4A, 0x19, 0x08, 0x07, 0x0F, 0x09, 0x38, 0x45, 0x43, 0x2D, 0x25, 0x4E,
- 0x3D, 0x0E, 0x0D, 0x23, 0x10, 0x24, 0x15, 0x37, 0x26, 0x0A, 0x02, 0x18,
- 0x12, 0x41, 0x46, 0x1A, 0x0B, 0x01, 0x36, 0x16, 0x50, 0x2F, 0x28, 0x44,
- 0x3A, 0x17, 0x06, 0x1D, 0x1B, 0x32, 0x2E, 0x3E, 0x35, 0x2A, 0x1E, 0x2C,
- 0x2B, 0x27, 0x22, 0x33, 0x31, 0x0C, 0x03, 0x20, 0x1F, 0x4D, 0x42, 0x3B,
- 0x39, 0x29, 0x21, 0x34, 0x30, 0x4B, 0x48, 0x05, 0x04, 0x1C, 0x11, 0x4C,
- 0x3F, 0x3C, 0x4F, 0x49, 0x13, 0x00, 0x47, 0x40, 0x14,
- },
- {
- 0x4C, 0x49, 0x1D, 0x17, 0x4E, 0x4B, 0x09, 0x04, 0x15, 0x0D, 0x38, 0x18,
- 0x3F, 0x3C, 0x26, 0x16, 0x3A, 0x28, 0x4F, 0x44, 0x40, 0x4D, 0x48, 0x32,
- 0x2F, 0x3D, 0x37, 0x2D, 0x2C, 0x35, 0x2E, 0x11, 0x0E, 0x23, 0x1B, 0x1E,
- 0x1C, 0x3B, 0x25, 0x05, 0x03, 0x0C, 0x08, 0x22, 0x21, 0x30, 0x27, 0x36,
- 0x42, 0x3E, 0x39, 0x34, 0x29, 0x20, 0x33, 0x31, 0x47, 0x45, 0x24, 0x1F,
- 0x2B, 0x2A, 0x06, 0x01, 0x10, 0x07, 0x46, 0x1A, 0x02, 0x00, 0x0B, 0x0A,
- 0x50, 0x41, 0x19, 0x12, 0x0F, 0x43, 0x13, 0x4A, 0x14,
- },
- {
- 0x46, 0x0B, 0x49, 0x47, 0x41, 0x23, 0x1E, 0x2D, 0x28, 0x15, 0x01, 0x1C,
- 0x17, 0x1F, 0x0C, 0x22, 0x20, 0x4E, 0x35, 0x32, 0x42, 0x3E, 0x27, 0x04,
- 0x31, 0x30, 0x3A, 0x2A, 0x3B, 0x39, 0x34, 0x29, 0x3D, 0x05, 0x03, 0x33,
- 0x21, 0x38, 0x2F, 0x4B, 0x3C, 0x26, 0x1D, 0x48, 0x40, 0x09, 0x08, 0x16,
- 0x0F, 0x4F, 0x11, 0x10, 0x2B, 0x25, 0x07, 0x06, 0x0E, 0x0D, 0x44, 0x43,
- 0x4D, 0x45, 0x2E, 0x2C, 0x37, 0x36, 0x24, 0x1B, 0x4C, 0x3F, 0x14, 0x4A,
- 0x1A, 0x13, 0x0A, 0x02, 0x00, 0x18, 0x12, 0x19, 0x50,
- },
- {
- 0x41, 0x19, 0x4F, 0x49, 0x26, 0x1E, 0x2F, 0x2D, 0x0F, 0x08, 0x1C, 0x15,
- 0x02, 0x00, 0x47, 0x12, 0x4A, 0x50, 0x1A, 0x23, 0x1D, 0x40, 0x38, 0x16,
- 0x09, 0x1B, 0x18, 0x3A, 0x37, 0x45, 0x44, 0x28, 0x11, 0x35, 0x32, 0x31,
- 0x2C, 0x29, 0x27, 0x34, 0x2A, 0x42, 0x20, 0x1F, 0x22, 0x21, 0x04, 0x03,
- 0x0C, 0x05, 0x4D, 0x3B, 0x39, 0x3E, 0x3D, 0x2B, 0x25, 0x33, 0x30, 0x3F,
- 0x36, 0x07, 0x06, 0x0E, 0x0D, 0x4C, 0x4B, 0x48, 0x3C, 0x2E, 0x4E, 0x43,
- 0x10, 0x01, 0x24, 0x17, 0x0B, 0x0A, 0x46, 0x13, 0x14,
- },
- {
- 0x19, 0x13, 0x50, 0x41, 0x1A, 0x0B, 0x0A, 0x4B, 0x46, 0x4A, 0x48, 0x47,
- 0x17, 0x16, 0x23, 0x1D, 0x08, 0x01, 0x11, 0x0F, 0x12, 0x02, 0x18, 0x15,
- 0x49, 0x43, 0x4E, 0x4C, 0x09, 0x00, 0x38, 0x37, 0x04, 0x03, 0x0C, 0x06,
- 0x45, 0x35, 0x2E, 0x3A, 0x36, 0x1C, 0x10, 0x25, 0x20, 0x28, 0x26, 0x3F,
- 0x3C, 0x1E, 0x0E, 0x2C, 0x24, 0x4F, 0x3B, 0x32, 0x3D, 0x39, 0x31, 0x07,
- 0x34, 0x33, 0x2A, 0x29, 0x2D, 0x2B, 0x42, 0x3E, 0x1B, 0x0D, 0x30, 0x27,
- 0x44, 0x40, 0x2F, 0x1F, 0x05, 0x22, 0x21, 0x4D, 0x14,
- },
- {
- 0x13, 0x0D, 0x1D, 0x19, 0x09, 0x41, 0x3D, 0x4A, 0x46, 0x28, 0x24, 0x31,
- 0x29, 0x25, 0x22, 0x3E, 0x33, 0x08, 0x01, 0x16, 0x0C, 0x47, 0x2C, 0x04,
- 0x03, 0x27, 0x05, 0x49, 0x17, 0x07, 0x2B, 0x20, 0x1F, 0x06, 0x2A, 0x21,
- 0x50, 0x4C, 0x4B, 0x44, 0x43, 0x45, 0x42, 0x4E, 0x4D, 0x3F, 0x3B, 0x48,
- 0x40, 0x34, 0x30, 0x4F, 0x39, 0x2E, 0x2D, 0x15, 0x11, 0x1E, 0x1C, 0x37,
- 0x0B, 0x38, 0x14, 0x02, 0x00, 0x10, 0x0E, 0x3C, 0x32, 0x26, 0x3A, 0x35,
- 0x18, 0x12, 0x23, 0x1B, 0x1A, 0x0F, 0x36, 0x2F, 0x0A,
- },
- {
- 0x37, 0x0E, 0x19, 0x17, 0x1D, 0x1A, 0x06, 0x01, 0x16, 0x10, 0x47, 0x44,
- 0x4F, 0x48, 0x4D, 0x08, 0x07, 0x42, 0x3F, 0x2C, 0x2B, 0x4C, 0x4B, 0x49,
- 0x40, 0x50, 0x4E, 0x45, 0x43, 0x1B, 0x04, 0x27, 0x22, 0x4A, 0x41, 0x3D,
- 0x12, 0x03, 0x34, 0x29, 0x46, 0x2F, 0x21, 0x25, 0x23, 0x3E, 0x35, 0x05,
- 0x00, 0x1F, 0x1E, 0x32, 0x18, 0x36, 0x33, 0x0A, 0x3C, 0x0F, 0x3A, 0x2E,
- 0x09, 0x02, 0x15, 0x11, 0x38, 0x31, 0x30, 0x3B, 0x39, 0x24, 0x20, 0x2D,
- 0x26, 0x1C, 0x0C, 0x2A, 0x28, 0x0D, 0x0B, 0x14, 0x13,
- },
- {
- 0x14, 0x13, 0x0B, 0x01, 0x0F, 0x0E, 0x4A, 0x50, 0x4F, 0x26, 0x24, 0x36,
- 0x28, 0x06, 0x05, 0x1C, 0x09, 0x3C, 0x37, 0x4B, 0x45, 0x18, 0x17, 0x41,
- 0x19, 0x49, 0x0A, 0x2A, 0x25, 0x4C, 0x38, 0x0C, 0x02, 0x16, 0x12, 0x48,
- 0x44, 0x3B, 0x39, 0x3E, 0x31, 0x22, 0x07, 0x34, 0x1B, 0x2D, 0x2F, 0x2C,
- 0x42, 0x3D, 0x43, 0x32, 0x30, 0x2B, 0x35, 0x33, 0x1F, 0x04, 0x27, 0x23,
- 0x3F, 0x3A, 0x10, 0x00, 0x29, 0x21, 0x47, 0x4E, 0x4D, 0x1E, 0x1D, 0x2E,
- 0x20, 0x08, 0x03, 0x11, 0x0D, 0x1A, 0x15, 0x46, 0x40,
+ 0x06, 0x01, 0x28, 0x11, 0x22, 0x20, 0x04, 0x07, 0x05, 0x16, 0x08, 0x60,
+ 0x02, 0x66, 0x61, 0x23, 0x15, 0x31, 0x26, 0x77, 0x12, 0x10, 0x42, 0x21,
+ 0x72, 0x50, 0x88, 0x82, 0x27, 0x24, 0x44, 0x40, 0x62, 0x55, 0x18, 0x13,
+ 0x53, 0x52, 0x64, 0x46, 0x41, 0x51, 0x47, 0x33, 0x32, 0x74, 0x67, 0x14,
+ 0x03, 0x30, 0x25, 0x36, 0x34, 0x45, 0x37, 0x78, 0x85, 0x84, 0x75, 0x73,
+ 0x57, 0x86, 0x65, 0x58, 0x71, 0x68, 0x70, 0x56, 0x54, 0x17, 0x76, 0x63,
+ 0x87, 0x81, 0x80, 0x38, 0x35, 0x48, 0x43, 0x83, 0x00,
+ },
+ {
+ 0x77, 0x62, 0x46, 0x33, 0x68, 0x52, 0x18, 0x05, 0x31, 0x25, 0x42, 0x04,
+ 0x51, 0x44, 0x40, 0x32, 0x55, 0x41, 0x26, 0x24, 0x30, 0x27, 0x57, 0x36,
+ 0x84, 0x76, 0x81, 0x83, 0x78, 0x73, 0x45, 0x85, 0x75, 0x86, 0x87, 0x56,
+ 0x53, 0x80, 0x67, 0x35, 0x34, 0x43, 0x37, 0x82, 0x70, 0x65, 0x74, 0x71,
+ 0x54, 0x48, 0x63, 0x58, 0x72, 0x64, 0x07, 0x03, 0x47, 0x38, 0x88, 0x20,
+ 0x01, 0x60, 0x28, 0x16, 0x02, 0x61, 0x50, 0x13, 0x08, 0x23, 0x17, 0x66,
+ 0x14, 0x06, 0x21, 0x15, 0x10, 0x00, 0x22, 0x12, 0x11,
+ },
+ {
+ 0x10, 0x01, 0x24, 0x12, 0x88, 0x83, 0x70, 0x14, 0x08, 0x46, 0x25, 0x87,
+ 0x44, 0x42, 0x60, 0x50, 0x61, 0x51, 0x71, 0x66, 0x15, 0x04, 0x41, 0x33,
+ 0x17, 0x03, 0x34, 0x18, 0x86, 0x68, 0x67, 0x63, 0x57, 0x75, 0x65, 0x45,
+ 0x36, 0x58, 0x54, 0x43, 0x37, 0x56, 0x53, 0x74, 0x62, 0x85, 0x78, 0x07,
+ 0x05, 0x35, 0x13, 0x84, 0x64, 0x55, 0x76, 0x73, 0x47, 0x38, 0x52, 0x48,
+ 0x11, 0x00, 0x21, 0x20, 0x82, 0x28, 0x81, 0x80, 0x31, 0x30, 0x40, 0x32,
+ 0x16, 0x06, 0x26, 0x23, 0x27, 0x02, 0x77, 0x72, 0x22,
+ },
+ {
+ 0x88, 0x82, 0x50, 0x47, 0x74, 0x43, 0x76, 0x75, 0x68, 0x24, 0x00, 0x37,
+ 0x30, 0x54, 0x44, 0x64, 0x58, 0x36, 0x34, 0x65, 0x40, 0x06, 0x03, 0x20,
+ 0x17, 0x08, 0x04, 0x48, 0x45, 0x87, 0x84, 0x71, 0x85, 0x78, 0x80, 0x73,
+ 0x07, 0x86, 0x63, 0x57, 0x70, 0x67, 0x77, 0x72, 0x83, 0x81, 0x32, 0x28,
+ 0x18, 0x05, 0x42, 0x38, 0x52, 0x14, 0x02, 0x25, 0x23, 0x66, 0x56, 0x53,
+ 0x62, 0x60, 0x35, 0x33, 0x46, 0x41, 0x21, 0x12, 0x10, 0x01, 0x26, 0x13,
+ 0x61, 0x22, 0x16, 0x27, 0x15, 0x55, 0x31, 0x51, 0x11,
+ },
+ {
+ 0x13, 0x10, 0x27, 0x14, 0x66, 0x44, 0x41, 0x53, 0x46, 0x25, 0x18, 0x35,
+ 0x33, 0x68, 0x63, 0x88, 0x71, 0x34, 0x24, 0x50, 0x47, 0x37, 0x08, 0x48,
+ 0x45, 0x82, 0x74, 0x70, 0x84, 0x76, 0x30, 0x04, 0x57, 0x43, 0x83, 0x78,
+ 0x86, 0x85, 0x73, 0x07, 0x80, 0x75, 0x87, 0x65, 0x56, 0x03, 0x00, 0x20,
+ 0x06, 0x72, 0x52, 0x31, 0x62, 0x60, 0x21, 0x15, 0x51, 0x22, 0x16, 0x12,
+ 0x02, 0x01, 0x23, 0x17, 0x55, 0x77, 0x64, 0x58, 0x54, 0x81, 0x67, 0x36,
+ 0x05, 0x40, 0x38, 0x28, 0x26, 0x42, 0x32, 0x61, 0x11,
+ },
+ {
+ 0x22, 0x11, 0x23, 0x13, 0x32, 0x25, 0x72, 0x45, 0x40, 0x57, 0x50, 0x03,
+ 0x00, 0x30, 0x08, 0x86, 0x75, 0x80, 0x68, 0x43, 0x04, 0x47, 0x07, 0x48,
+ 0x65, 0x58, 0x85, 0x84, 0x78, 0x64, 0x67, 0x63, 0x74, 0x73, 0x06, 0x05,
+ 0x44, 0x37, 0x87, 0x83, 0x46, 0x42, 0x54, 0x53, 0x18, 0x17, 0x36, 0x34,
+ 0x66, 0x55, 0x38, 0x24, 0x56, 0x41, 0x02, 0x01, 0x20, 0x14, 0x16, 0x12,
+ 0x61, 0x27, 0x26, 0x15, 0x31, 0x28, 0x21, 0x88, 0x82, 0x62, 0x60, 0x76,
+ 0x70, 0x33, 0x10, 0x52, 0x35, 0x71, 0x51, 0x81, 0x77,
+ },
+ {
+ 0x16, 0x12, 0x61, 0x22, 0x51, 0x21, 0x15, 0x52, 0x31, 0x55, 0x81, 0x66,
+ 0x46, 0x42, 0x62, 0x54, 0x14, 0x01, 0x25, 0x23, 0x27, 0x13, 0x56, 0x41,
+ 0x35, 0x33, 0x58, 0x53, 0x26, 0x10, 0x32, 0x28, 0x84, 0x77, 0x43, 0x00,
+ 0x68, 0x47, 0x85, 0x45, 0x34, 0x57, 0x50, 0x05, 0x03, 0x37, 0x30, 0x87,
+ 0x86, 0x76, 0x08, 0x07, 0x80, 0x75, 0x70, 0x73, 0x04, 0x78, 0x74, 0x63,
+ 0x48, 0x71, 0x67, 0x82, 0x65, 0x17, 0x06, 0x24, 0x20, 0x88, 0x83, 0x60,
+ 0x44, 0x40, 0x72, 0x64, 0x18, 0x02, 0x38, 0x36, 0x11,
+ },
+ {
+ 0x66, 0x01, 0x14, 0x03, 0x24, 0x23, 0x62, 0x08, 0x04, 0x35, 0x20, 0x72,
+ 0x63, 0x58, 0x70, 0x68, 0x48, 0x45, 0x54, 0x53, 0x26, 0x25, 0x65, 0x44,
+ 0x13, 0x05, 0x51, 0x41, 0x61, 0x16, 0x12, 0x10, 0x06, 0x28, 0x27, 0x60,
+ 0x40, 0x32, 0x56, 0x52, 0x17, 0x00, 0x31, 0x18, 0x73, 0x30, 0x75, 0x74,
+ 0x88, 0x84, 0x83, 0x86, 0x80, 0x85, 0x43, 0x38, 0x87, 0x47, 0x76, 0x71,
+ 0x50, 0x37, 0x78, 0x57, 0x82, 0x77, 0x67, 0x33, 0x07, 0x36, 0x34, 0x81,
+ 0x46, 0x42, 0x64, 0x55, 0x15, 0x02, 0x22, 0x21, 0x11,
+ },
+ {
+ 0x22, 0x00, 0x11, 0x01, 0x20, 0x08, 0x88, 0x62, 0x27, 0x02, 0x07, 0x06,
+ 0x21, 0x12, 0x28, 0x87, 0x66, 0x32, 0x30, 0x38, 0x33, 0x15, 0x14, 0x25,
+ 0x17, 0x26, 0x24, 0x60, 0x42, 0x78, 0x71, 0x84, 0x81, 0x44, 0x23, 0x52,
+ 0x50, 0x80, 0x70, 0x35, 0x13, 0x48, 0x46, 0x83, 0x51, 0x40, 0x64, 0x61,
+ 0x55, 0x47, 0x74, 0x58, 0x18, 0x03, 0x41, 0x31, 0x73, 0x68, 0x43, 0x36,
+ 0x57, 0x45, 0x85, 0x56, 0x54, 0x67, 0x65, 0x76, 0x75, 0x37, 0x34, 0x63,
+ 0x53, 0x86, 0x77, 0x72, 0x05, 0x04, 0x16, 0x10, 0x82,
+ },
+ {
+ 0x22, 0x12, 0x27, 0x21, 0x14, 0x01, 0x20, 0x15, 0x62, 0x02, 0x00, 0x16,
+ 0x10, 0x60, 0x17, 0x72, 0x66, 0x28, 0x07, 0x06, 0x18, 0x13, 0x82, 0x55,
+ 0x40, 0x78, 0x71, 0x25, 0x23, 0x32, 0x31, 0x42, 0x26, 0x61, 0x52, 0x24,
+ 0x08, 0x50, 0x44, 0x77, 0x37, 0x34, 0x63, 0x57, 0x87, 0x84, 0x80, 0x86,
+ 0x83, 0x45, 0x36, 0x85, 0x73, 0x70, 0x68, 0x81, 0x74, 0x33, 0x03, 0x38,
+ 0x35, 0x88, 0x56, 0x54, 0x76, 0x75, 0x46, 0x43, 0x53, 0x48, 0x64, 0x51,
+ 0x58, 0x47, 0x67, 0x65, 0x05, 0x04, 0x41, 0x30, 0x11,
+ },
+ {
+ 0x44, 0x40, 0x66, 0x60, 0x23, 0x16, 0x32, 0x30, 0x07, 0x06, 0x18, 0x14,
+ 0x86, 0x50, 0x47, 0x75, 0x55, 0x33, 0x31, 0x41, 0x35, 0x80, 0x70, 0x84,
+ 0x83, 0x78, 0x71, 0x87, 0x81, 0x77, 0x12, 0x38, 0x25, 0x52, 0x51, 0x08,
+ 0x01, 0x17, 0x15, 0x58, 0x54, 0x68, 0x67, 0x34, 0x13, 0x48, 0x46, 0x04,
+ 0x03, 0x36, 0x05, 0x85, 0x56, 0x45, 0x65, 0x57, 0x73, 0x43, 0x37, 0x63,
+ 0x53, 0x64, 0x61, 0x76, 0x74, 0x24, 0x10, 0x62, 0x42, 0x21, 0x11, 0x02,
+ 0x00, 0x26, 0x20, 0x88, 0x28, 0x27, 0x82, 0x72, 0x22,
+ },
+ {
+ 0x28, 0x27, 0x71, 0x70, 0x87, 0x78, 0x82, 0x22, 0x77, 0x72, 0x07, 0x01,
+ 0x14, 0x08, 0x81, 0x66, 0x62, 0x80, 0x75, 0x40, 0x25, 0x51, 0x50, 0x02,
+ 0x00, 0x26, 0x20, 0x42, 0x24, 0x52, 0x44, 0x16, 0x10, 0x23, 0x17, 0x64,
+ 0x60, 0x86, 0x83, 0x46, 0x41, 0x55, 0x54, 0x48, 0x47, 0x58, 0x56, 0x18,
+ 0x04, 0x35, 0x31, 0x57, 0x38, 0x34, 0x03, 0x63, 0x53, 0x67, 0x13, 0x05,
+ 0x36, 0x33, 0x73, 0x61, 0x43, 0x37, 0x68, 0x65, 0x45, 0x85, 0x76, 0x74,
+ 0x15, 0x06, 0x32, 0x30, 0x84, 0x12, 0x11, 0x88, 0x21,
+ },
+ {
+ 0x82, 0x27, 0x08, 0x07, 0x16, 0x10, 0x62, 0x76, 0x74, 0x50, 0x41, 0x86,
+ 0x67, 0x15, 0x14, 0x38, 0x17, 0x40, 0x23, 0x61, 0x42, 0x11, 0x02, 0x26,
+ 0x20, 0x72, 0x77, 0x28, 0x12, 0x01, 0x60, 0x24, 0x88, 0x52, 0x44, 0x75,
+ 0x64, 0x25, 0x06, 0x32, 0x30, 0x55, 0x51, 0x68, 0x58, 0x46, 0x33, 0x48,
+ 0x47, 0x43, 0x37, 0x56, 0x54, 0x13, 0x03, 0x35, 0x34, 0x85, 0x73, 0x65,
+ 0x63, 0x45, 0x36, 0x57, 0x53, 0x83, 0x80, 0x05, 0x04, 0x31, 0x18, 0x84,
+ 0x70, 0x66, 0x87, 0x81, 0x21, 0x00, 0x78, 0x71, 0x22,
+ },
+ {
+ 0x84, 0x81, 0x32, 0x25, 0x86, 0x83, 0x10, 0x04, 0x23, 0x14, 0x62, 0x26,
+ 0x70, 0x66, 0x42, 0x24, 0x64, 0x44, 0x87, 0x75, 0x71, 0x85, 0x80, 0x55,
+ 0x52, 0x67, 0x61, 0x50, 0x48, 0x58, 0x51, 0x18, 0x15, 0x38, 0x30, 0x33,
+ 0x31, 0x65, 0x41, 0x05, 0x03, 0x13, 0x08, 0x37, 0x36, 0x53, 0x43, 0x60,
+ 0x73, 0x68, 0x63, 0x57, 0x45, 0x35, 0x56, 0x54, 0x78, 0x76, 0x40, 0x34,
+ 0x47, 0x46, 0x06, 0x01, 0x17, 0x07, 0x77, 0x28, 0x02, 0x00, 0x12, 0x11,
+ 0x88, 0x72, 0x27, 0x20, 0x16, 0x74, 0x21, 0x82, 0x22,
+ },
+ {
+ 0x77, 0x12, 0x81, 0x78, 0x72, 0x38, 0x33, 0x50, 0x44, 0x23, 0x01, 0x31,
+ 0x25, 0x34, 0x13, 0x37, 0x35, 0x86, 0x58, 0x55, 0x73, 0x68, 0x43, 0x04,
+ 0x54, 0x53, 0x64, 0x46, 0x65, 0x63, 0x57, 0x45, 0x67, 0x05, 0x03, 0x56,
+ 0x36, 0x62, 0x52, 0x83, 0x66, 0x42, 0x32, 0x80, 0x71, 0x10, 0x08, 0x24,
+ 0x16, 0x87, 0x18, 0x17, 0x47, 0x41, 0x07, 0x06, 0x15, 0x14, 0x75, 0x74,
+ 0x85, 0x76, 0x51, 0x48, 0x61, 0x60, 0x40, 0x30, 0x84, 0x70, 0x22, 0x82,
+ 0x28, 0x21, 0x11, 0x02, 0x00, 0x26, 0x20, 0x27, 0x88,
+ },
+ {
+ 0x72, 0x27, 0x87, 0x81, 0x42, 0x33, 0x52, 0x50, 0x16, 0x08, 0x31, 0x23,
+ 0x02, 0x00, 0x78, 0x20, 0x82, 0x88, 0x28, 0x38, 0x32, 0x71, 0x62, 0x24,
+ 0x10, 0x30, 0x26, 0x64, 0x61, 0x76, 0x75, 0x44, 0x18, 0x58, 0x55, 0x54,
+ 0x48, 0x45, 0x43, 0x57, 0x46, 0x73, 0x35, 0x34, 0x37, 0x36, 0x04, 0x03,
+ 0x13, 0x05, 0x85, 0x65, 0x63, 0x68, 0x67, 0x47, 0x41, 0x56, 0x53, 0x70,
+ 0x60, 0x07, 0x06, 0x15, 0x14, 0x84, 0x83, 0x80, 0x66, 0x51, 0x86, 0x74,
+ 0x17, 0x01, 0x40, 0x25, 0x12, 0x11, 0x77, 0x21, 0x22,
+ },
+ {
+ 0x27, 0x21, 0x88, 0x72, 0x28, 0x12, 0x11, 0x83, 0x77, 0x82, 0x80, 0x78,
+ 0x25, 0x24, 0x38, 0x32, 0x08, 0x01, 0x18, 0x16, 0x20, 0x02, 0x26, 0x23,
+ 0x81, 0x74, 0x86, 0x84, 0x10, 0x00, 0x62, 0x61, 0x04, 0x03, 0x13, 0x06,
+ 0x76, 0x58, 0x51, 0x64, 0x60, 0x31, 0x17, 0x41, 0x35, 0x44, 0x42, 0x70,
+ 0x66, 0x33, 0x15, 0x48, 0x40, 0x87, 0x65, 0x55, 0x67, 0x63, 0x54, 0x07,
+ 0x57, 0x56, 0x46, 0x45, 0x50, 0x47, 0x73, 0x68, 0x30, 0x14, 0x53, 0x43,
+ 0x75, 0x71, 0x52, 0x34, 0x05, 0x37, 0x36, 0x85, 0x22,
+ },
+ {
+ 0x21, 0x14, 0x32, 0x27, 0x10, 0x72, 0x67, 0x82, 0x77, 0x44, 0x40, 0x54,
+ 0x45, 0x41, 0x37, 0x68, 0x56, 0x08, 0x01, 0x24, 0x13, 0x78, 0x48, 0x04,
+ 0x03, 0x43, 0x05, 0x81, 0x25, 0x07, 0x47, 0x35, 0x34, 0x06, 0x46, 0x36,
+ 0x88, 0x84, 0x83, 0x75, 0x74, 0x76, 0x73, 0x86, 0x85, 0x70, 0x65, 0x80,
+ 0x71, 0x57, 0x53, 0x87, 0x63, 0x51, 0x50, 0x23, 0x18, 0x33, 0x31, 0x61,
+ 0x12, 0x62, 0x22, 0x02, 0x00, 0x17, 0x15, 0x66, 0x55, 0x42, 0x64, 0x58,
+ 0x26, 0x20, 0x38, 0x30, 0x28, 0x16, 0x60, 0x52, 0x11,
+ },
+ {
+ 0x61, 0x15, 0x27, 0x25, 0x32, 0x28, 0x06, 0x01, 0x24, 0x17, 0x78, 0x75,
+ 0x87, 0x80, 0x85, 0x08, 0x07, 0x73, 0x70, 0x48, 0x47, 0x84, 0x83, 0x81,
+ 0x71, 0x88, 0x86, 0x76, 0x74, 0x30, 0x04, 0x43, 0x37, 0x82, 0x72, 0x67,
+ 0x20, 0x03, 0x57, 0x45, 0x77, 0x52, 0x36, 0x41, 0x38, 0x68, 0x58, 0x05,
+ 0x00, 0x34, 0x33, 0x55, 0x26, 0x60, 0x56, 0x11, 0x66, 0x16, 0x64, 0x51,
+ 0x10, 0x02, 0x23, 0x18, 0x62, 0x54, 0x53, 0x65, 0x63, 0x40, 0x35, 0x50,
+ 0x42, 0x31, 0x13, 0x46, 0x44, 0x14, 0x12, 0x22, 0x21,
+ },
+ {
+ 0x22, 0x21, 0x12, 0x01, 0x16, 0x15, 0x82, 0x88, 0x87, 0x42, 0x40, 0x60,
+ 0x44, 0x06, 0x05, 0x31, 0x10, 0x66, 0x61, 0x83, 0x76, 0x26, 0x25, 0x72,
+ 0x27, 0x81, 0x11, 0x46, 0x41, 0x84, 0x62, 0x13, 0x02, 0x24, 0x20, 0x80,
+ 0x75, 0x65, 0x63, 0x68, 0x54, 0x37, 0x07, 0x57, 0x30, 0x50, 0x52, 0x48,
+ 0x73, 0x67, 0x74, 0x55, 0x53, 0x47, 0x58, 0x56, 0x34, 0x04, 0x43, 0x38,
+ 0x70, 0x64, 0x17, 0x00, 0x45, 0x36, 0x78, 0x86, 0x85, 0x33, 0x32, 0x51,
+ 0x35, 0x08, 0x03, 0x18, 0x14, 0x28, 0x23, 0x77, 0x71,
},
};
RealVideo 4.0 has a VLC that encodes two intra types per code; each intra type is in the range 0..8 (inclusive) and up until now the VLC used symbols in the range 0..80; one type was encoded as the remainder when dividing the symbol by 9 whereas the other type was encoded as symbol / 9. This is suboptimal; a better way would be to use the high and low nibble to encode each symbol. But an even better way is to use 16bit symbols so that the two intra types can be directly written as a 16bit value. This commit implements this; in order to avoid huge tables the symbols are stored as uint8_t with high and low nibbles encoding one type each; they are only unpacked to uint16_t during initialization. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavcodec/rv40.c | 20 ++- libavcodec/rv40vlc2.h | 356 +++++++++++++++++++++--------------------- 2 files changed, 193 insertions(+), 183 deletions(-)