1 |
#include "../portab.h" |
#include "../portab.h" |
2 |
|
#include "../global.h" |
3 |
#include "adapt_quant.h" |
#include "adapt_quant.h" |
4 |
|
|
5 |
#include <stdlib.h> /* free, malloc */ |
#include <stdlib.h> /* free, malloc */ |
6 |
|
|
|
#define MAX(a,b) (((a) > (b)) ? (a) : (b)) |
|
7 |
#define RDIFF(a,b) ((int)(a+0.5)-(int)(b+0.5)) |
#define RDIFF(a,b) ((int)(a+0.5)-(int)(b+0.5)) |
8 |
|
|
9 |
int |
int |
65 |
{ |
{ |
66 |
int i, j, k, l; |
int i, j, k, l; |
67 |
|
|
68 |
static float *quant; |
float *quant; |
69 |
unsigned char *ptr; |
unsigned char *ptr; |
70 |
float *val; |
float *val; |
71 |
float global = 0.; |
float global = 0.; |
84 |
const float LowerLimit = 25; |
const float LowerLimit = 25; |
85 |
|
|
86 |
|
|
|
if (!quant) |
|
87 |
if (!(quant = (float *) malloc(mb_width * mb_height * sizeof(float)))) |
if (!(quant = (float *) malloc(mb_width * mb_height * sizeof(float)))) |
88 |
return -1; |
return(-1); |
89 |
|
|
90 |
val = (float *) malloc(mb_width * mb_height * sizeof(float)); |
if(!(val = (float *) malloc(mb_width * mb_height * sizeof(float)))) |
91 |
|
return(-1); |
92 |
|
|
93 |
for (k = 0; k < mb_height; k++) { |
for (k = 0; k < mb_height; k++) { |
94 |
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 |
130 |
} |
} |
131 |
} |
} |
132 |
} |
} |
133 |
free(val); |
|
134 |
return normalize_quantizer_field(quant, intquant, mb_width * mb_height, |
i = normalize_quantizer_field(quant, intquant, |
135 |
|
mb_width * mb_height, |
136 |
min_quant, max_quant); |
min_quant, max_quant); |
137 |
|
|
138 |
|
free(val); |
139 |
|
free(quant); |
140 |
|
|
141 |
|
return(i); |
142 |
|
|
143 |
} |
} |