#include "vid_sim.h"Go to the source code of this file.
Functions | |
| void | Quant (int *coeff, int *qcoeff, int QP, int Mode) |
| void | Dequant (int *qcoeff, int *rcoeff, int QP, int Mode) |
|
||||||||||||||||||||
|
Definition at line 108 of file vid_quant.c. References MODE_INTRA, and sign. Referenced by MB_Decode(). 00109 {
00110 int i;
00111
00112 if (QP) {
00113 for (i = 0; i < 64; i++) {
00114 if (qcoeff[i]) {
00115 if ((QP % 2) == 1)
00116 rcoeff[i] = QP * (2*abs(qcoeff[i]) + 1);
00117 else
00118 rcoeff[i] = QP * (2*abs(qcoeff[i]) + 1) - 1;
00119 rcoeff[i] = sign(qcoeff[i]) * rcoeff[i];
00120 }
00121 else
00122 rcoeff[i] = 0;
00123 }
00124 if (Mode == MODE_INTRA || Mode == MODE_INTRA_Q) { /* Intra */
00125 rcoeff[0] = qcoeff[0]*8;
00126 }
00127 }
00128 else {
00129 /* No quantizing at all */
00130 for (i = 0; i < 64; i++) {
00131 rcoeff[i] = qcoeff[i];
00132 }
00133 }
00134 return;
00135 }
|
|
||||||||||||||||||||
|
Definition at line 61 of file vid_quant.c. References mmax, mmin, MODE_INTRA, and sign. Referenced by MB_Encode(). 00062 {
00063 int i;
00064 int level;
00065
00066 if (QP) {
00067 if (Mode == MODE_INTRA || Mode == MODE_INTRA_Q) { /* Intra */
00068 qcoeff[0] = mmax(1,mmin(254,coeff[0]/8));
00069
00070 for (i = 1; i < 64; i++) {
00071 level = (abs(coeff[i])) / (2*QP);
00072 qcoeff[i] = mmin(127,mmax(-127,sign(coeff[i]) * level));
00073 }
00074 }
00075 else { /* non Intra */
00076 for (i = 0; i < 64; i++) {
00077 level = (abs(coeff[i])-QP/2) / (2*QP);
00078 qcoeff[i] = mmin(127,mmax(-127,sign(coeff[i]) * level));
00079 }
00080 }
00081 }
00082 else {
00083 /* No quantizing.
00084 Used only for testing. Bitstream will not be decodable
00085 whether clipping is performed or not */
00086 for (i = 0; i < 64; i++) {
00087 qcoeff[i] = coeff[i];
00088 }
00089 }
00090 return;
00091 }
|
1.3.9.1