00001
00014 #ifndef _QUANT_H_
00015 #define _QUANT_H_
00016
00017
00018 #define Q_BITS 15
00019 #define DQ_BITS 6
00020 #define Q_BITS_8 16
00021 #define DQ_BITS_8 6
00022
00023
00024 static const int dequant_coef8[6][8][8] =
00025 {
00026 {
00027 {20, 19, 25, 19, 20, 19, 25, 19},
00028 {19, 18, 24, 18, 19, 18, 24, 18},
00029 {25, 24, 32, 24, 25, 24, 32, 24},
00030 {19, 18, 24, 18, 19, 18, 24, 18},
00031 {20, 19, 25, 19, 20, 19, 25, 19},
00032 {19, 18, 24, 18, 19, 18, 24, 18},
00033 {25, 24, 32, 24, 25, 24, 32, 24},
00034 {19, 18, 24, 18, 19, 18, 24, 18}
00035 },
00036 {
00037 {22, 21, 28, 21, 22, 21, 28, 21},
00038 {21, 19, 26, 19, 21, 19, 26, 19},
00039 {28, 26, 35, 26, 28, 26, 35, 26},
00040 {21, 19, 26, 19, 21, 19, 26, 19},
00041 {22, 21, 28, 21, 22, 21, 28, 21},
00042 {21, 19, 26, 19, 21, 19, 26, 19},
00043 {28, 26, 35, 26, 28, 26, 35, 26},
00044 {21, 19, 26, 19, 21, 19, 26, 19}
00045 },
00046 {
00047 {26, 24, 33, 24, 26, 24, 33, 24},
00048 {24, 23, 31, 23, 24, 23, 31, 23},
00049 {33, 31, 42, 31, 33, 31, 42, 31},
00050 {24, 23, 31, 23, 24, 23, 31, 23},
00051 {26, 24, 33, 24, 26, 24, 33, 24},
00052 {24, 23, 31, 23, 24, 23, 31, 23},
00053 {33, 31, 42, 31, 33, 31, 42, 31},
00054 {24, 23, 31, 23, 24, 23, 31, 23}
00055 },
00056 {
00057 {28, 26, 35, 26, 28, 26, 35, 26},
00058 {26, 25, 33, 25, 26, 25, 33, 25},
00059 {35, 33, 45, 33, 35, 33, 45, 33},
00060 {26, 25, 33, 25, 26, 25, 33, 25},
00061 {28, 26, 35, 26, 28, 26, 35, 26},
00062 {26, 25, 33, 25, 26, 25, 33, 25},
00063 {35, 33, 45, 33, 35, 33, 45, 33},
00064 {26, 25, 33, 25, 26, 25, 33, 25}
00065 },
00066 {
00067 {32, 30, 40, 30, 32, 30, 40, 30},
00068 {30, 28, 38, 28, 30, 28, 38, 28},
00069 {40, 38, 51, 38, 40, 38, 51, 38},
00070 {30, 28, 38, 28, 30, 28, 38, 28},
00071 {32, 30, 40, 30, 32, 30, 40, 30},
00072 {30, 28, 38, 28, 30, 28, 38, 28},
00073 {40, 38, 51, 38, 40, 38, 51, 38},
00074 {30, 28, 38, 28, 30, 28, 38, 28}
00075 },
00076 {
00077 {36, 34, 46, 34, 36, 34, 46, 34},
00078 {34, 32, 43, 32, 34, 32, 43, 32},
00079 {46, 43, 58, 43, 46, 43, 58, 43},
00080 {34, 32, 43, 32, 34, 32, 43, 32},
00081 {36, 34, 46, 34, 36, 34, 46, 34},
00082 {34, 32, 43, 32, 34, 32, 43, 32},
00083 {46, 43, 58, 43, 46, 43, 58, 43},
00084 {34, 32, 43, 32, 34, 32, 43, 32}
00085 }
00086 };
00087
00088
00090 static const int dequant_coef[6][4][4] = {
00091 {
00092 { 10, 13, 10, 13},
00093 { 13, 16, 13, 16},
00094 { 10, 13, 10, 13},
00095 { 13, 16, 13, 16}},
00096 {
00097 { 11, 14, 11, 14},
00098 { 14, 18, 14, 18},
00099 { 11, 14, 11, 14},
00100 { 14, 18, 14, 18}},
00101 {
00102 { 13, 16, 13, 16},
00103 { 16, 20, 16, 20},
00104 { 13, 16, 13, 16},
00105 { 16, 20, 16, 20}},
00106 {
00107 { 14, 18, 14, 18},
00108 { 18, 23, 18, 23},
00109 { 14, 18, 14, 18},
00110 { 18, 23, 18, 23}},
00111 {
00112 { 16, 20, 16, 20},
00113 { 20, 25, 20, 25},
00114 { 16, 20, 16, 20},
00115 { 20, 25, 20, 25}},
00116 {
00117 { 18, 23, 18, 23},
00118 { 23, 29, 23, 29},
00119 { 18, 23, 18, 23},
00120 { 23, 29, 23, 29}}
00121 };
00122
00123 static const int quant_coef[6][4][4] = {
00124 {
00125 { 13107, 8066, 13107, 8066},
00126 { 8066, 5243, 8066, 5243},
00127 { 13107, 8066, 13107, 8066},
00128 { 8066, 5243, 8066, 5243}},
00129 {
00130 { 11916, 7490, 11916, 7490},
00131 { 7490, 4660, 7490, 4660},
00132 { 11916, 7490, 11916, 7490},
00133 { 7490, 4660, 7490, 4660}},
00134 {
00135 { 10082, 6554, 10082, 6554},
00136 { 6554, 4194, 6554, 4194},
00137 { 10082, 6554, 10082, 6554},
00138 { 6554, 4194, 6554, 4194}},
00139 {
00140 { 9362, 5825, 9362, 5825},
00141 { 5825, 3647, 5825, 3647},
00142 { 9362, 5825, 9362, 5825},
00143 { 5825, 3647, 5825, 3647}},
00144 {
00145 { 8192, 5243, 8192, 5243},
00146 { 5243, 3355, 5243, 3355},
00147 { 8192, 5243, 8192, 5243},
00148 { 5243, 3355, 5243, 3355}},
00149 {
00150 { 7282, 4559, 7282, 4559},
00151 { 4559, 2893, 4559, 2893},
00152 { 7282, 4559, 7282, 4559},
00153 { 4559, 2893, 4559, 2893}}
00154 };
00155
00156
00157 static const int A[4][4] = {
00158 { 16, 20, 16, 20},
00159 { 20, 25, 20, 25},
00160 { 16, 20, 16, 20},
00161 { 20, 25, 20, 25}
00162 };
00163
00164
00165
00166 extern void init_qp_process (ImageParameters *p_Img);
00167 extern void free_qp_matrices(ImageParameters *p_Img);
00168
00169
00170 extern void assign_quant_params (Slice *currslice, pic_parameter_set_rbsp_t* pps, seq_parameter_set_rbsp_t* sps);
00171 extern void CalculateQuant4x4Param(Slice *currslice);
00172 extern void CalculateQuant8x8Param(Slice *currslice);
00173
00174 #endif
00175