73 |
/* this isnt pretty, but its better than 20 ifdefs */ |
/* this isnt pretty, but its better than 20 ifdefs */ |
74 |
|
|
75 |
void MBTransQuantIntra(const MBParam *pParam, |
void MBTransQuantIntra(const MBParam *pParam, |
76 |
|
FRAMEINFO * frame, |
77 |
MACROBLOCK * pMB, |
MACROBLOCK * pMB, |
78 |
const uint32_t x_pos, |
const uint32_t x_pos, |
79 |
const uint32_t y_pos, |
const uint32_t y_pos, |
80 |
int16_t data[6*64], |
int16_t data[6*64], |
81 |
int16_t qcoeff[6*64], |
int16_t qcoeff[6*64]) |
|
IMAGE * const pCurrent) |
|
82 |
|
|
83 |
{ |
{ |
84 |
|
|
86 |
uint32_t stride2 = stride / 2; |
uint32_t stride2 = stride / 2; |
87 |
uint32_t next_block = stride * 8; |
uint32_t next_block = stride * 8; |
88 |
uint32_t i; |
uint32_t i; |
89 |
uint32_t iQuant = pParam->quant; |
uint32_t iQuant = frame->quant; |
90 |
uint8_t *pY_Cur, *pU_Cur, *pV_Cur; |
uint8_t *pY_Cur, *pU_Cur, *pV_Cur; |
91 |
|
IMAGE * pCurrent = &frame->image; |
92 |
|
|
93 |
pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4); |
pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4); |
94 |
pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3); |
pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3); |
105 |
|
|
106 |
start_timer(); |
start_timer(); |
107 |
pMB->field_dct = 0; |
pMB->field_dct = 0; |
108 |
if (pParam->global_flags & XVID_INTERLACING) |
if ((frame->global_flags & XVID_INTERLACING)) |
109 |
{ |
{ |
110 |
pMB->field_dct = MBDecideFieldDCT(data); |
pMB->field_dct = MBDecideFieldDCT(data); |
111 |
} |
} |
119 |
fdct(&data[i*64]); |
fdct(&data[i*64]); |
120 |
stop_dct_timer(); |
stop_dct_timer(); |
121 |
|
|
122 |
if (pParam->quant_type == H263_QUANT) |
if (pParam->m_quant_type == H263_QUANT) |
123 |
{ |
{ |
124 |
start_timer(); |
start_timer(); |
125 |
quant_intra(&qcoeff[i*64], &data[i*64], iQuant, iDcScaler); |
quant_intra(&qcoeff[i*64], &data[i*64], iQuant, iDcScaler); |
164 |
|
|
165 |
|
|
166 |
uint8_t MBTransQuantInter(const MBParam *pParam, |
uint8_t MBTransQuantInter(const MBParam *pParam, |
167 |
|
FRAMEINFO * frame, |
168 |
MACROBLOCK * pMB, |
MACROBLOCK * pMB, |
169 |
const uint32_t x_pos, const uint32_t y_pos, |
const uint32_t x_pos, const uint32_t y_pos, |
170 |
int16_t data[6*64], |
int16_t data[6*64], |
171 |
int16_t qcoeff[6*64], |
int16_t qcoeff[6*64]) |
|
IMAGE * const pCurrent) |
|
172 |
|
|
173 |
{ |
{ |
174 |
|
|
176 |
uint32_t stride2 = stride / 2; |
uint32_t stride2 = stride / 2; |
177 |
uint32_t next_block = stride * 8; |
uint32_t next_block = stride * 8; |
178 |
uint32_t i; |
uint32_t i; |
179 |
uint32_t iQuant = pParam->quant; |
uint32_t iQuant = frame->quant; |
180 |
uint8_t *pY_Cur, *pU_Cur, *pV_Cur; |
uint8_t *pY_Cur, *pU_Cur, *pV_Cur; |
181 |
uint8_t cbp = 0; |
uint8_t cbp = 0; |
182 |
uint32_t sum; |
uint32_t sum; |
183 |
|
IMAGE * pCurrent = &frame->image; |
184 |
|
|
185 |
pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4); |
pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4); |
186 |
pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3); |
pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3); |
188 |
|
|
189 |
start_timer(); |
start_timer(); |
190 |
pMB->field_dct = 0; |
pMB->field_dct = 0; |
191 |
if (pParam->global_flags & XVID_INTERLACING) |
if ((frame->global_flags & XVID_INTERLACING)) |
192 |
{ |
{ |
193 |
pMB->field_dct = MBDecideFieldDCT(data); |
pMB->field_dct = MBDecideFieldDCT(data); |
194 |
} |
} |
204 |
fdct(&data[i*64]); |
fdct(&data[i*64]); |
205 |
stop_dct_timer(); |
stop_dct_timer(); |
206 |
|
|
207 |
if (pParam->quant_type == 0) |
if (pParam->m_quant_type == 0) |
208 |
{ |
{ |
209 |
start_timer(); |
start_timer(); |
210 |
sum = quant_inter(&qcoeff[i*64], &data[i*64], iQuant); |
sum = quant_inter(&qcoeff[i*64], &data[i*64], iQuant); |
219 |
|
|
220 |
if(sum >= TOOSMALL_LIMIT) { // skip block ? |
if(sum >= TOOSMALL_LIMIT) { // skip block ? |
221 |
|
|
222 |
if (pParam->quant_type == H263_QUANT) |
if (pParam->m_quant_type == H263_QUANT) |
223 |
{ |
{ |
224 |
start_timer(); |
start_timer(); |
225 |
dequant_inter(&data[i*64], &qcoeff[i*64], iQuant); |
dequant_inter(&data[i*64], &qcoeff[i*64], iQuant); |