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 |
|
* 2002 Christoph Lampert <gruel@web.de> |
8 |
* |
* |
9 |
* 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 |
10 |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
29 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
30 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
31 |
* |
* |
32 |
* $Id: adapt_quant.c,v 1.7 2002-09-07 12:51:38 edgomez Exp $ |
* $Id: adapt_quant.c,v 1.11 2002-10-19 12:20:33 edgomez Exp $ |
33 |
* |
* |
34 |
****************************************************************************/ |
****************************************************************************/ |
35 |
|
|
126 |
if (!(quant = (float *) malloc(mb_width * mb_height * sizeof(float)))) |
if (!(quant = (float *) malloc(mb_width * mb_height * sizeof(float)))) |
127 |
return(-1); |
return(-1); |
128 |
|
|
129 |
if(!(val = (float *) malloc(mb_width * mb_height * sizeof(float)))) |
if(!(val = (float *) malloc(mb_width * mb_height * sizeof(float)))) { |
130 |
|
free(quant); |
131 |
return(-1); |
return(-1); |
132 |
|
} |
133 |
|
|
134 |
for (k = 0; k < mb_height; k++) { |
for (k = 0; k < mb_height; k++) { |
135 |
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 |
171 |
} |
} |
172 |
} |
} |
173 |
} |
} |
174 |
|
|
175 |
|
i = normalize_quantizer_field(quant, intquant, |
176 |
|
mb_width * mb_height, |
177 |
|
min_quant, max_quant); |
178 |
|
|
179 |
free(val); |
free(val); |
180 |
free(quant); |
free(quant); |
181 |
return normalize_quantizer_field(quant, intquant, mb_width * mb_height, |
|
182 |
min_quant, max_quant); |
return(i); |
183 |
|
|
184 |
} |
} |