mirror of
https://github.com/WinampDesktop/winamp.git
synced 2024-11-28 07:00:48 +01:00
154 lines
9.9 KiB
C
154 lines
9.9 KiB
C
|
/* ///////////////////////////////////////////////////////////////////////
|
||
|
//
|
||
|
// INTEL CORPORATION PROPRIETARY INFORMATION
|
||
|
// This software is supplied under the terms of a license agreement or
|
||
|
// nondisclosure agreement with Intel Corporation and may not be copied
|
||
|
// or disclosed except in accordance with the terms of that agreement.
|
||
|
// Copyright (c) 2001-2007 Intel Corporation. All Rights Reserved.
|
||
|
//
|
||
|
// Description: MPEG-4 related tables.
|
||
|
//
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
#include "mp4def.h"
|
||
|
|
||
|
#define DI(b) ((1 << 18) + b) / b
|
||
|
|
||
|
const int32_t mp4_DivIntraDivisor[47] = {
|
||
|
DI( 1), DI( 1), DI( 2), DI( 3), DI( 4), DI( 5), DI( 6), DI( 7), DI( 8), DI( 9),
|
||
|
DI(10), DI(11), DI(12), DI(13), DI(14), DI(15), DI(16), DI(17), DI(18), DI(19),
|
||
|
DI(20), DI(21), DI(22), DI(23), DI(24), DI(25), DI(26), DI(27), DI(28), DI(29),
|
||
|
DI(30), DI(31), DI(32), DI(33), DI(34), DI(35), DI(36), DI(37), DI(38), DI(39),
|
||
|
DI(40), DI(41), DI(42), DI(43), DI(44), DI(45), DI(46)
|
||
|
};
|
||
|
|
||
|
#define DCSL(q) (q <= 4) ? 8 : (q <= 8) ? (q << 1) : (q <= 24) ? (q + 8) : ((q << 1) - 16)
|
||
|
|
||
|
const uint8_t mp4_DCScalerLuma[32] = {
|
||
|
DCSL( 0), DCSL( 1), DCSL( 2), DCSL( 3), DCSL( 4), DCSL( 5), DCSL( 6), DCSL( 7),
|
||
|
DCSL( 8), DCSL( 9), DCSL(10), DCSL(11), DCSL(12), DCSL(13), DCSL(14), DCSL(15),
|
||
|
DCSL(16), DCSL(17), DCSL(18), DCSL(19), DCSL(20), DCSL(21), DCSL(22), DCSL(23),
|
||
|
DCSL(24), DCSL(25), DCSL(26), DCSL(27), DCSL(28), DCSL(29), DCSL(30), DCSL(31)
|
||
|
};
|
||
|
|
||
|
#define DCSC(q) (q <= 4) ? 8 : (q <= 24) ? ((q + 13) >> 1) : (q - 6)
|
||
|
|
||
|
const uint8_t mp4_DCScalerChroma[32] = {
|
||
|
DCSC( 0), DCSC( 1), DCSC( 2), DCSC( 3), DCSC( 4), DCSC( 5), DCSC( 6), DCSC( 7),
|
||
|
DCSC( 8), DCSC( 9), DCSC(10), DCSC(11), DCSC(12), DCSC(13), DCSC(14), DCSC(15),
|
||
|
DCSC(16), DCSC(17), DCSC(18), DCSC(19), DCSC(20), DCSC(21), DCSC(22), DCSC(23),
|
||
|
DCSC(24), DCSC(25), DCSC(26), DCSC(27), DCSC(28), DCSC(29), DCSC(30), DCSC(31)
|
||
|
};
|
||
|
|
||
|
const uint8_t mp4_DefaultIntraQuantMatrix[64] = {
|
||
|
8, 17, 18, 19, 21, 23, 25, 27, 17, 18, 19, 21, 23, 25, 27, 28,
|
||
|
20, 21, 22, 23, 24, 26, 28, 30, 21, 22, 23, 24, 26, 28, 30, 32,
|
||
|
22, 23, 24, 26, 28, 30, 32, 35, 23, 24, 26, 28, 30, 32, 35, 38,
|
||
|
25, 26, 28, 30, 32, 35, 38, 41, 27, 28, 30, 32, 35, 38, 41, 45
|
||
|
};
|
||
|
|
||
|
const uint8_t mp4_DefaultNonIntraQuantMatrix[64] = {
|
||
|
16, 17, 18, 19, 20, 21, 22, 23, 17, 18, 19, 20, 21, 22, 23, 24,
|
||
|
18, 19, 20, 21, 22, 23, 24, 25, 19, 20, 21, 22, 23, 24, 26, 27,
|
||
|
20, 21, 22, 23, 25, 26, 27, 28, 21, 22, 23, 24, 26, 27, 28, 30,
|
||
|
22, 23, 24, 26, 27, 28, 30, 31, 23, 24, 25, 27, 28, 30, 31, 33
|
||
|
};
|
||
|
|
||
|
const uint8_t mp4_ClassicalZigzag[64] = {
|
||
|
0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
|
||
|
12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
|
||
|
35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
|
||
|
58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
|
||
|
};
|
||
|
|
||
|
const uint8_t mp4_cCbCrMvRound16[16] = {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2};
|
||
|
const uint8_t mp4_cCbCrMvRound12[12] = {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2};
|
||
|
const uint8_t mp4_cCbCrMvRound8[8] = {0, 0, 1, 1, 1, 1, 1, 2};
|
||
|
const uint8_t mp4_cCbCrMvRound4[4] = {0, 1, 1, 1};
|
||
|
|
||
|
const Ipp8s mp4_dquant[4] = {-1, -2, 1, 2};
|
||
|
|
||
|
const mp4_VLC1 mp4_cbpy1[4] = {{0,255},{0,2},{1,1},{1,1}};
|
||
|
const mp4_VLC1 mp4_cbpy2[16] = {{0,255},{0,4},{1,3},{1,3},{2,2},{2,2},{2,2},{2,2},{3,1},{3,1},{3,1},{3,1},{3,1},{3,1},{3,1},{3,1}};
|
||
|
const mp4_VLC1 mp4_cbpy3[64] = {{1,255},{1,6},{2,5},{2,5},{4,5},{4,5},{5,5},{5,5},{6,3},{6,3},{6,3},{6,3},{6,3},{6,3},{6,3},{6,3},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{0,3},{0,3},{0,3},{0,3},{0,3},{0,3},{0,3},{0,3},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1},{7,1}};
|
||
|
const mp4_VLC1 mp4_cbpy4[64] = {{16,255},{16,255},{6,6},{9,6},{8,5},{8,5},{4,5},{4,5},{2,5},{2,5},{1,5},{1,5},{0,4},{0,4},{0,4},{0,4},{12,4},{12,4},{12,4},{12,4},{10,4},{10,4},{10,4},{10,4},{14,4},{14,4},{14,4},{14,4},{5,4},{5,4},{5,4},{5,4},{13,4},{13,4},{13,4},{13,4},{3,4},{3,4},{3,4},{3,4},{11,4},{11,4},{11,4},{11,4},{7,4},{7,4},{7,4},{7,4},{15,2},{15,2},{15,2},{15,2},{15,2},{15,2},{15,2},{15,2},{15,2},{15,2},{15,2},{15,2},{15,2},{15,2},{15,2},{15,2}};
|
||
|
const mp4_VLC1* mp4_cbpy_t[4] = {mp4_cbpy1, mp4_cbpy2, mp4_cbpy3, mp4_cbpy4};
|
||
|
const uint8_t mp4_cbpy_b[4] = {2, 4, 6, 6};
|
||
|
|
||
|
const int32_t mp4_DC_vlc_Threshold[8] = {512, 13, 15, 17, 19, 21, 23, 0};
|
||
|
|
||
|
const uint8_t mp4_PVOPmb_type[256] = {255,255,4,4,4,1,3,3,3,3,2,2,3,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3};
|
||
|
|
||
|
const mp4_VLC1 mp4_BVOPmb_type[16] = {
|
||
|
{255, 255}, {IPPVC_MBTYPE_FORWARD, 4}, {IPPVC_MBTYPE_BACKWARD, 3}, {IPPVC_MBTYPE_BACKWARD, 3},
|
||
|
{IPPVC_MBTYPE_INTERPOLATE, 2}, {IPPVC_MBTYPE_INTERPOLATE, 2}, {IPPVC_MBTYPE_INTERPOLATE, 2}, {IPPVC_MBTYPE_INTERPOLATE, 2},
|
||
|
{IPPVC_MBTYPE_DIRECT, 1}, {IPPVC_MBTYPE_DIRECT, 1}, {IPPVC_MBTYPE_DIRECT, 1}, {IPPVC_MBTYPE_DIRECT, 1},
|
||
|
{IPPVC_MBTYPE_DIRECT, 1}, {IPPVC_MBTYPE_DIRECT, 1}, {IPPVC_MBTYPE_DIRECT, 1}, {IPPVC_MBTYPE_DIRECT, 1}
|
||
|
};
|
||
|
|
||
|
const mp4_VLC1 mp4_MVD_B12_1[] = {
|
||
|
{32,12},{31,12},
|
||
|
{30,11},{30,11},{29,11},{29,11},{28,11},{28,11},
|
||
|
{27,11},{27,11},{26,11},{26,11},{25,11},{25,11},
|
||
|
{24,10},{24,10},{24,10},{24,10},{23,10},{23,10},{23,10},{23,10},
|
||
|
{22,10},{22,10},{22,10},{22,10},{21,10},{21,10},{21,10},{21,10},
|
||
|
{20,10},{20,10},{20,10},{20,10},{19,10},{19,10},{19,10},{19,10},
|
||
|
{18,10},{18,10},{18,10},{18,10},{17,10},{17,10},{17,10},{17,10},
|
||
|
{16,10},{16,10},{16,10},{16,10},{15,10},{15,10},{15,10},{15,10},
|
||
|
{14,10},{14,10},{14,10},{14,10},{13,10},{13,10},{13,10},{13,10},
|
||
|
{12,10},{12,10},{12,10},{12,10},{11,10},{11,10},{11,10},{11,10},
|
||
|
{10,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 1, 2},{ 1, 2},{ 1, 2},{ 1, 2},
|
||
|
{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},
|
||
|
{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},
|
||
|
{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},
|
||
|
{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},
|
||
|
{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},
|
||
|
{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},
|
||
|
{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},
|
||
|
{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},{ 0, 1},
|
||
|
};
|
||
|
|
||
|
const int32_t mp4_H263_width[5] = {128, 176, 352, 704, 1408};
|
||
|
const int32_t mp4_H263_height[5] = {96, 144, 288, 576, 1152};
|
||
|
const int32_t mp4_H263_mbgob[5] = {8, 11, 22, 88, 352};
|
||
|
const int32_t mp4_H263_gobvop[5] = {6, 9, 18, 18, 18};
|
||
|
const int32_t mp4_H263_rowgob[5] = {1, 1, 1, 2, 4};
|
||
|
|
||
|
const uint8_t mp4_aux_comp_count[MP4_SHAPE_EXT_NUM+1] = {1, 1, 2, 2, 3, 1, 2, 1, 1, 2, 3, 2, 3, 0};
|
||
|
const uint8_t mp4_aux_comp_is_alpha[MP4_SHAPE_EXT_NUM+1] = {1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0};
|
||
|
const uint8_t mp4_BABt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