[cvs] / xvidcore / src / utils / mbtransquant.c Repository:
ViewVC logotype

Diff of /xvidcore/src/utils/mbtransquant.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11.2.5, Tue Nov 12 16:05:27 2002 UTC revision 1.11.2.6, Mon Dec 9 10:47:05 2002 UTC
# Line 65  Line 65 
65  #include "../quant/quant_h263.h"  #include "../quant/quant_h263.h"
66  #include "../encoder.h"  #include "../encoder.h"
67    
68    #include "../image/reduced.h"
69    
70  MBFIELDTEST_PTR MBFieldTest;  MBFIELDTEST_PTR MBFieldTest;
71    
72  #define MIN(X, Y) ((X)<(Y)?(X):(Y))  #define MIN(X, Y) ((X)<(Y)?(X):(Y))
# Line 84  Line 86 
86    
87          uint32_t stride = pParam->edged_width;          uint32_t stride = pParam->edged_width;
88          uint32_t stride2 = stride / 2;          uint32_t stride2 = stride / 2;
89          uint32_t next_block = stride * 8;          uint32_t next_block = stride * ((frame->global_flags & XVID_REDUCED)?16:8);
90          uint32_t i;          uint32_t i;
91          uint32_t iQuant = frame->quant;          uint32_t iQuant = frame->quant;
92          uint8_t *pY_Cur, *pU_Cur, *pV_Cur;          uint8_t *pY_Cur, *pU_Cur, *pV_Cur;
93          IMAGE *pCurrent = &frame->image;          IMAGE *pCurrent = &frame->image;
94    
95            start_timer();
96            if ((frame->global_flags & XVID_REDUCED))
97            {
98                    pY_Cur = pCurrent->y + (y_pos << 5) * stride + (x_pos << 5);
99                    pU_Cur = pCurrent->u + (y_pos << 4) * stride2 + (x_pos << 4);
100                    pV_Cur = pCurrent->v + (y_pos << 4) * stride2 + (x_pos << 4);
101    
102                    filter_18x18_to_8x8(&data[0 * 64], pY_Cur, stride);
103                    filter_18x18_to_8x8(&data[1 * 64], pY_Cur + 16, stride);
104                    filter_18x18_to_8x8(&data[2 * 64], pY_Cur + next_block, stride);
105                    filter_18x18_to_8x8(&data[3 * 64], pY_Cur + next_block + 16, stride);
106                    filter_18x18_to_8x8(&data[4 * 64], pU_Cur, stride2);
107                    filter_18x18_to_8x8(&data[5 * 64], pV_Cur, stride2);
108            }else{
109          pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4);          pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4);
110          pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3);          pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3);
111          pV_Cur = pCurrent->v + (y_pos << 3) * stride2 + (x_pos << 3);          pV_Cur = pCurrent->v + (y_pos << 3) * stride2 + (x_pos << 3);
112    
         start_timer();  
113          transfer_8to16copy(&data[0 * 64], pY_Cur, stride);          transfer_8to16copy(&data[0 * 64], pY_Cur, stride);
114          transfer_8to16copy(&data[1 * 64], pY_Cur + 8, stride);          transfer_8to16copy(&data[1 * 64], pY_Cur + 8, stride);
115          transfer_8to16copy(&data[2 * 64], pY_Cur + next_block, stride);          transfer_8to16copy(&data[2 * 64], pY_Cur + next_block, stride);
116          transfer_8to16copy(&data[3 * 64], pY_Cur + next_block + 8, stride);          transfer_8to16copy(&data[3 * 64], pY_Cur + next_block + 8, stride);
117          transfer_8to16copy(&data[4 * 64], pU_Cur, stride2);          transfer_8to16copy(&data[4 * 64], pU_Cur, stride2);
118          transfer_8to16copy(&data[5 * 64], pV_Cur, stride2);          transfer_8to16copy(&data[5 * 64], pV_Cur, stride2);
119            }
120          stop_transfer_timer();          stop_transfer_timer();
121    
122            /* XXX: rrv+interlacing is buggy */
123          start_timer();          start_timer();
124          pMB->field_dct = 0;          pMB->field_dct = 0;
125          if ((frame->global_flags & XVID_INTERLACING) &&          if ((frame->global_flags & XVID_INTERLACING) &&
# Line 123  Line 140 
140                          start_timer();                          start_timer();
141                          quant_intra(&qcoeff[i * 64], &data[i * 64], iQuant, iDcScaler);                          quant_intra(&qcoeff[i * 64], &data[i * 64], iQuant, iDcScaler);
142                          stop_quant_timer();                          stop_quant_timer();
   
                         start_timer();  
                         dequant_intra(&data[i * 64], &qcoeff[i * 64], iQuant, iDcScaler);  
                         stop_iquant_timer();  
143                  } else {                  } else {
144                          start_timer();                          start_timer();
145                          quant4_intra(&qcoeff[i * 64], &data[i * 64], iQuant, iDcScaler);                          quant4_intra(&qcoeff[i * 64], &data[i * 64], iQuant, iDcScaler);
146                          stop_quant_timer();                          stop_quant_timer();
147                    }
148    
149                    /* speedup: dont decode when encoding only ivops */
150                    if (pParam->iMaxKeyInterval != 1 || pParam->max_bframes > 0)
151                    {
152                            if (pParam->m_quant_type == H263_QUANT) {
153                                    start_timer();
154                                    dequant_intra(&data[i * 64], &qcoeff[i * 64], iQuant, iDcScaler);
155                                    stop_iquant_timer();
156                            } else {
157                          start_timer();                          start_timer();
158                          dequant4_intra(&data[i * 64], &qcoeff[i * 64], iQuant, iDcScaler);                          dequant4_intra(&data[i * 64], &qcoeff[i * 64], iQuant, iDcScaler);
159                          stop_iquant_timer();                          stop_iquant_timer();
# Line 141  Line 163 
163                  idct(&data[i * 64]);                  idct(&data[i * 64]);
164                  stop_idct_timer();                  stop_idct_timer();
165          }          }
166            }
167    
168            /* speedup: dont decode when encoding only ivops */
169            if (pParam->iMaxKeyInterval != 1 || pParam->max_bframes > 0)
170            {
171    
172          if (pMB->field_dct) {          if (pMB->field_dct) {
173                  next_block = stride;                  next_block = stride;
# Line 148  Line 175 
175          }          }
176    
177          start_timer();          start_timer();
178                    if ((frame->global_flags & XVID_REDUCED))
179                    {
180                            copy_upsampled_8x8_16to8(pY_Cur, &data[0 * 64], stride);
181                            copy_upsampled_8x8_16to8(pY_Cur + 16, &data[1 * 64], stride);
182                            copy_upsampled_8x8_16to8(pY_Cur + next_block, &data[2 * 64], stride);
183                            copy_upsampled_8x8_16to8(pY_Cur + next_block + 16, &data[3 * 64], stride);
184                            copy_upsampled_8x8_16to8(pU_Cur, &data[4 * 64], stride2);
185                            copy_upsampled_8x8_16to8(pV_Cur, &data[5 * 64], stride2);
186    
187                    }else{
188          transfer_16to8copy(pY_Cur, &data[0 * 64], stride);          transfer_16to8copy(pY_Cur, &data[0 * 64], stride);
189          transfer_16to8copy(pY_Cur + 8, &data[1 * 64], stride);          transfer_16to8copy(pY_Cur + 8, &data[1 * 64], stride);
190          transfer_16to8copy(pY_Cur + next_block, &data[2 * 64], stride);          transfer_16to8copy(pY_Cur + next_block, &data[2 * 64], stride);
191          transfer_16to8copy(pY_Cur + next_block + 8, &data[3 * 64], stride);          transfer_16to8copy(pY_Cur + next_block + 8, &data[3 * 64], stride);
192          transfer_16to8copy(pU_Cur, &data[4 * 64], stride2);          transfer_16to8copy(pU_Cur, &data[4 * 64], stride2);
193          transfer_16to8copy(pV_Cur, &data[5 * 64], stride2);          transfer_16to8copy(pV_Cur, &data[5 * 64], stride2);
194                    }
195          stop_transfer_timer();          stop_transfer_timer();
196            }
197    
198  }  }
199    
# Line 171  Line 210 
210    
211          uint32_t stride = pParam->edged_width;          uint32_t stride = pParam->edged_width;
212          uint32_t stride2 = stride / 2;          uint32_t stride2 = stride / 2;
213          uint32_t next_block = stride * 8;          uint32_t next_block = stride * ((frame->global_flags & XVID_REDUCED)?16:8);
214          uint32_t i;          uint32_t i;
215          uint32_t iQuant = frame->quant;          uint32_t iQuant = frame->quant;
216          uint8_t *pY_Cur, *pU_Cur, *pV_Cur;          uint8_t *pY_Cur, *pU_Cur, *pV_Cur;
# Line 179  Line 218 
218          uint32_t sum;          uint32_t sum;
219          IMAGE *pCurrent = &frame->image;          IMAGE *pCurrent = &frame->image;
220    
221            if ((frame->global_flags & XVID_REDUCED))
222            {
223                    pY_Cur = pCurrent->y + (y_pos << 5) * stride + (x_pos << 5);
224                    pU_Cur = pCurrent->u + (y_pos << 4) * stride2 + (x_pos << 4);
225                    pV_Cur = pCurrent->v + (y_pos << 4) * stride2 + (x_pos << 4);
226            }else{
227          pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4);          pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4);
228          pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3);          pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3);
229          pV_Cur = pCurrent->v + (y_pos << 3) * stride2 + (x_pos << 3);          pV_Cur = pCurrent->v + (y_pos << 3) * stride2 + (x_pos << 3);
230            }
231    
232          start_timer();          start_timer();
233          pMB->field_dct = 0;          pMB->field_dct = 0;
# Line 240  Line 286 
286          }          }
287    
288          start_timer();          start_timer();
289            if ((frame->global_flags & XVID_REDUCED))
290            {
291                    if (cbp & 32)
292                            add_upsampled_8x8_16to8(pY_Cur, &data[0 * 64], stride);
293                    if (cbp & 16)
294                            add_upsampled_8x8_16to8(pY_Cur + 16, &data[1 * 64], stride);
295                    if (cbp & 8)
296                            add_upsampled_8x8_16to8(pY_Cur + next_block, &data[2 * 64], stride);
297                    if (cbp & 4)
298                            add_upsampled_8x8_16to8(pY_Cur + 16 + next_block, &data[3 * 64], stride);
299                    if (cbp & 2)
300                            add_upsampled_8x8_16to8(pU_Cur, &data[4 * 64], stride2);
301                    if (cbp & 1)
302                            add_upsampled_8x8_16to8(pV_Cur, &data[5 * 64], stride2);
303            }else{
304          if (cbp & 32)          if (cbp & 32)
305                  transfer_16to8add(pY_Cur, &data[0 * 64], stride);                  transfer_16to8add(pY_Cur, &data[0 * 64], stride);
306          if (cbp & 16)          if (cbp & 16)
# Line 252  Line 313 
313                  transfer_16to8add(pU_Cur, &data[4 * 64], stride2);                  transfer_16to8add(pU_Cur, &data[4 * 64], stride2);
314          if (cbp & 1)          if (cbp & 1)
315                  transfer_16to8add(pV_Cur, &data[5 * 64], stride2);                  transfer_16to8add(pV_Cur, &data[5 * 64], stride2);
316            }
317          stop_transfer_timer();          stop_transfer_timer();
318    
319          return cbp;          return cbp;

Legend:
Removed from v.1.11.2.5  
changed lines
  Added in v.1.11.2.6

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4