mp4_iquant.c
上传用户:tuheem
上传日期:2007-05-01
资源大小:21889k
文件大小:1k
- #include "mp4_vars.h"
- #include "mp4_predict.h"
- #include "mp4_iquant.h"
- #define _iquant_h263(coeff, q_2scale, q_add) if ((coeff) != 0) {
- if ((coeff) > 0) {
- (coeff) = ((q_2scale) * (coeff)) + (q_add); }
- else if ((coeff) < 0) {
- (coeff) *= -1;
- (coeff) = ((q_2scale) * (coeff)) + (q_add);
- (coeff) *= -1; }
- }
- /**
- *
- **/
- __inline void iquant (short * psblock, int intraFlag)
- {
- int i;
- int q_scale = mp4_state->hdr.quantizer;
- int q_2scale = q_scale << 1;
- int q_add = (q_scale & 1) ? q_scale : (q_scale - 1);
- for (i = intraFlag; i < 64; i++)
- {
- _iquant_h263(psblock[i], q_2scale, q_add);
- }
- }
- void iquant_typefirst (short * psblock)
- {
- int i;
- for (i = 1; i < 64; i++)
- {
- if (psblock[i] != 0) {
- psblock[i] = (psblock[i] * 2 * mp4_state->hdr.quantizer *
- mp4_tables->intra_quant_matrix[mp4_tables->zig_zag_scan[i]]) >> 4;
- }
- }
- }