3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - Adaptive quantization functions - |
* - Adaptive quantization functions - |
5 |
* |
* |
6 |
* Copyright(C) 2002 Peter Ross |
* Copyright(C) 2002 Peter Ross <pross@xvid.org> |
7 |
* |
* |
8 |
* This program is an implementation of a part of one or more MPEG-4 |
* This program is an implementation of a part of one or more MPEG-4 |
9 |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
125 |
if (!(quant = (float *) malloc(mb_width * mb_height * sizeof(float)))) |
if (!(quant = (float *) malloc(mb_width * mb_height * sizeof(float)))) |
126 |
return(-1); |
return(-1); |
127 |
|
|
128 |
if(!(val = (float *) malloc(mb_width * mb_height * sizeof(float)))) |
if(!(val = (float *) malloc(mb_width * mb_height * sizeof(float)))) { |
129 |
|
free(quant); |
130 |
return(-1); |
return(-1); |
131 |
|
} |
132 |
|
|
133 |
for (k = 0; k < mb_height; k++) { |
for (k = 0; k < mb_height; k++) { |
134 |
for (l = 0; l < mb_width; l++) // do this for all macroblocks individually |
for (l = 0; l < mb_width; l++) // do this for all macroblocks individually |
170 |
} |
} |
171 |
} |
} |
172 |
} |
} |
173 |
|
|
174 |
|
i = normalize_quantizer_field(quant, intquant, |
175 |
|
mb_width * mb_height, |
176 |
|
min_quant, max_quant); |
177 |
|
|
178 |
free(val); |
free(val); |
179 |
free(quant); |
free(quant); |
180 |
return normalize_quantizer_field(quant, intquant, mb_width * mb_height, |
|
181 |
min_quant, max_quant); |
return(i); |
182 |
|
|
183 |
} |
} |