[svn] / branches / dev-api-4 / xvidcore / src / utils / mbtransquant.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/src/utils/mbtransquant.c

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

revision 982, Thu Apr 10 13:05:54 2003 UTC revision 995, Sun Apr 27 19:47:48 2003 UTC
# Line 21  Line 21 
21   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
22   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23   *   *
24   * $Id: mbtransquant.c,v 1.21.2.7 2003-04-10 13:05:54 edgomez Exp $   * $Id: mbtransquant.c,v 1.21.2.9 2003-04-27 19:47:48 chl Exp $
25   *   *
26   ****************************************************************************/   ****************************************************************************/
27    
# Line 34  Line 34 
34  #include "../global.h"  #include "../global.h"
35  #include "mem_transfer.h"  #include "mem_transfer.h"
36  #include "timer.h"  #include "timer.h"
37    #include "../bitstream/mbcoding.h"
38  #include "../dct/fdct.h"  #include "../dct/fdct.h"
39  #include "../dct/idct.h"  #include "../dct/idct.h"
40  #include "../quant/quant_mpeg4.h"  #include "../quant/quant_mpeg4.h"
# Line 69  Line 70 
70    
71  /* Performs Forward DCT on all blocks */  /* Performs Forward DCT on all blocks */
72  static __inline void  static __inline void
73  MBfDCT(const MBParam * pParam,  MBfDCT(const MBParam * const pParam,
74             FRAMEINFO * frame,             const FRAMEINFO * const frame,
75             MACROBLOCK * pMB,             MACROBLOCK * const pMB,
76             uint32_t x_pos,             uint32_t x_pos,
77             uint32_t y_pos,             uint32_t y_pos,
78             int16_t data[6 * 64])             int16_t data[6 * 64])
# Line 115  Line 116 
116  /* Quantize all blocks -- Intra mode */  /* Quantize all blocks -- Intra mode */
117  static __inline void  static __inline void
118  MBQuantIntra(const MBParam * pParam,  MBQuantIntra(const MBParam * pParam,
119                             const FRAMEINFO * const frame,
120                           const MACROBLOCK * pMB,                           const MACROBLOCK * pMB,
121                       int16_t qcoeff[6 * 64],                       int16_t qcoeff[6 * 64],
122                           int16_t data[6*64])                           int16_t data[6*64])
# Line 126  Line 128 
128    
129                  /* Quantize the block */                  /* Quantize the block */
130                  start_timer();                  start_timer();
131                  if (!(pParam->vol_flags & XVID_VOL_MPEGQUANT))                  if (!(pParam->vol_flags & XVID_VOL_MPEGQUANT)) {
132                          quant_intra(&data[i * 64], &qcoeff[i * 64], pMB->quant, iDcScaler);                          quant_intra(&data[i * 64], &qcoeff[i * 64], pMB->quant, iDcScaler);
133                  else                  } else {
134                          quant4_intra(&data[i * 64], &qcoeff[i * 64], pMB->quant, iDcScaler);                          quant4_intra(&data[i * 64], &qcoeff[i * 64], pMB->quant, iDcScaler);
135                    }
136                  stop_quant_timer();                  stop_quant_timer();
137          }          }
138  }  }
# Line 158  Line 161 
161  /* Quantize all blocks -- Inter mode */  /* Quantize all blocks -- Inter mode */
162  static __inline uint8_t  static __inline uint8_t
163  MBQuantInter(const MBParam * pParam,  MBQuantInter(const MBParam * pParam,
164                             const FRAMEINFO * const frame,
165                           const MACROBLOCK * pMB,                           const MACROBLOCK * pMB,
166                           int16_t data[6 * 64],                           int16_t data[6 * 64],
167                           int16_t qcoeff[6 * 64],                           int16_t qcoeff[6 * 64],
# Line 174  Line 178 
178    
179                  /* Quantize the block */                  /* Quantize the block */
180                  start_timer();                  start_timer();
181                  if (!(pParam->vol_flags & XVID_VOL_MPEGQUANT))                  if (!(pParam->vol_flags & XVID_VOL_MPEGQUANT)) {
182                          sum = quant_inter(&qcoeff[i * 64], &data[i * 64], pMB->quant);                          sum = quant_inter(&qcoeff[i * 64], &data[i * 64], pMB->quant);
183                  else                          if ( (sum) && (frame->vop_flags & XVID_VOP_TRELLISQUANT) ) {
184                                    sum = dct_quantize_trellis_inter_h263_c (&qcoeff[i*64], &data[i*64], pMB->quant)+1;
185                                    limit = 1;
186                            }
187                    } else {
188                          sum = quant4_inter(&qcoeff[i * 64], &data[i * 64], pMB->quant);                          sum = quant4_inter(&qcoeff[i * 64], &data[i * 64], pMB->quant);
189    //                      if ( (sum) && (frame->vop_flags & XVID_VOP_TRELLISQUANT) )
190    //                              sum = dct_quantize_trellis_inter_mpeg_c (&qcoeff[i*64], &data[i*64], pMB->quant)+1;
191                    }
192                  stop_quant_timer();                  stop_quant_timer();
193    
194                  /*                  /*
# Line 202  Line 213 
213    
214                  /* Set the corresponding cbp bit */                  /* Set the corresponding cbp bit */
215                  cbp |= code_block << (5 - i);                  cbp |= code_block << (5 - i);
   
216          }          }
217    
218          return(cbp);          return(cbp);
# Line 235  Line 245 
245    
246    
247  static __inline void  static __inline void
248  MBTrans8to16(const MBParam * pParam,  MBTrans8to16(const MBParam * const pParam,
249                           FRAMEINFO * frame,                           const FRAMEINFO * const frame,
250                           MACROBLOCK * pMB,                           const MACROBLOCK * const pMB,
251                           const uint32_t x_pos,                           const uint32_t x_pos,
252                           const uint32_t y_pos,                           const uint32_t y_pos,
253                           int16_t data[6 * 64])                           int16_t data[6 * 64])
# Line 247  Line 257 
257          uint32_t next_block = stride * 8;          uint32_t next_block = stride * 8;
258          int32_t cst;          int32_t cst;
259          uint8_t *pY_Cur, *pU_Cur, *pV_Cur;          uint8_t *pY_Cur, *pU_Cur, *pV_Cur;
260          IMAGE *pCurrent = &frame->image;          const IMAGE * const pCurrent = &frame->image;
261          transfer_operation_8to16_t *transfer_op = NULL;          transfer_operation_8to16_t *transfer_op = NULL;
262    
263          if ((frame->vop_flags & XVID_VOP_REDUCED)) {          if ((frame->vop_flags & XVID_VOP_REDUCED)) {
# Line 288  Line 298 
298  }  }
299    
300  static __inline void  static __inline void
301  MBTrans16to8(const MBParam * pParam,  MBTrans16to8(const MBParam * const pParam,
302                           FRAMEINFO * frame,                           const FRAMEINFO * const frame,
303                           MACROBLOCK * pMB,                           const MACROBLOCK * const pMB,
304                           const uint32_t x_pos,                           const uint32_t x_pos,
305                           const uint32_t y_pos,                           const uint32_t y_pos,
306                           int16_t data[6 * 64],                           int16_t data[6 * 64],
# Line 302  Line 312 
312          uint32_t stride2 = stride / 2;          uint32_t stride2 = stride / 2;
313          uint32_t next_block = stride * 8;          uint32_t next_block = stride * 8;
314          uint32_t cst;          uint32_t cst;
315          IMAGE *pCurrent = &frame->image;          const IMAGE * const pCurrent = &frame->image;
316          transfer_operation_16to8_t *transfer_op = NULL;          transfer_operation_16to8_t *transfer_op = NULL;
317    
318          if (pMB->field_dct) {          if (pMB->field_dct) {
# Line 358  Line 368 
368   ****************************************************************************/   ****************************************************************************/
369    
370  void  void
371  MBTransQuantIntra(const MBParam * pParam,  MBTransQuantIntra(const MBParam * const pParam,
372                                    FRAMEINFO * frame,                                    const FRAMEINFO * const frame,
373                                    MACROBLOCK * pMB,                                    MACROBLOCK * const pMB,
374                                    const uint32_t x_pos,                                    const uint32_t x_pos,
375                                    const uint32_t y_pos,                                    const uint32_t y_pos,
376                                    int16_t data[6 * 64],                                    int16_t data[6 * 64],
# Line 374  Line 384 
384          MBfDCT(pParam, frame, pMB, x_pos, y_pos, data);          MBfDCT(pParam, frame, pMB, x_pos, y_pos, data);
385    
386          /* Quantize the block */          /* Quantize the block */
387          MBQuantIntra(pParam, pMB, data, qcoeff);          MBQuantIntra(pParam, frame, pMB, data, qcoeff);
388    
389          /* DeQuantize the block */          /* DeQuantize the block */
390          MBDeQuantIntra(pParam, pMB->quant, data, qcoeff);          MBDeQuantIntra(pParam, pMB->quant, data, qcoeff);
# Line 388  Line 398 
398    
399    
400  uint8_t  uint8_t
401  MBTransQuantInter(const MBParam * pParam,  MBTransQuantInter(const MBParam * const pParam,
402                                    FRAMEINFO * frame,                                    const FRAMEINFO * const frame,
403                                    MACROBLOCK * pMB,                                    MACROBLOCK * const pMB,
404                                    const uint32_t x_pos,                                    const uint32_t x_pos,
405                                    const uint32_t y_pos,                                    const uint32_t y_pos,
406                                    int16_t data[6 * 64],                                    int16_t data[6 * 64],
# Line 411  Line 421 
421          limit = PVOP_TOOSMALL_LIMIT + ((pMB->quant == 1)? 1 : 0);          limit = PVOP_TOOSMALL_LIMIT + ((pMB->quant == 1)? 1 : 0);
422    
423          /* Quantize the block */          /* Quantize the block */
424          cbp = MBQuantInter(pParam, pMB, data, qcoeff, 0, limit);          cbp = MBQuantInter(pParam, frame, pMB, data, qcoeff, 0, limit);
425    
426          /* DeQuantize the block */          /* DeQuantize the block */
427          MBDeQuantInter(pParam, pMB->quant, data, qcoeff, cbp);          MBDeQuantInter(pParam, pMB->quant, data, qcoeff, cbp);
# Line 449  Line 459 
459          limit = BVOP_TOOSMALL_LIMIT;          limit = BVOP_TOOSMALL_LIMIT;
460    
461          /* Quantize the block */          /* Quantize the block */
462          cbp = MBQuantInter(pParam, pMB, data, qcoeff, 1, limit);          cbp = MBQuantInter(pParam, frame, pMB, data, qcoeff, 1, limit);
463    
464          /*          /*
465           * History comment:           * History comment:

Legend:
Removed from v.982  
changed lines
  Added in v.995

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