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

Diff of /xvidcore/src/decoder.c

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

revision 1.63, Sat Jul 24 11:46:08 2004 UTC revision 1.64, Mon Jul 26 19:32:28 2004 UTC
# Line 396  Line 396 
396                                  uint8_t * pY_Cur,                                  uint8_t * pY_Cur,
397                                  uint8_t * pU_Cur,                                  uint8_t * pU_Cur,
398                                  uint8_t * pV_Cur,                                  uint8_t * pV_Cur,
399                                  const int reduced_resolution,                                  int reduced_resolution,
400                                  const MACROBLOCK * pMB)                                  const MACROBLOCK * pMB)
401  {  {
402          DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(data, 1, 64, int16_t, CACHE_LINE);
403    
404          int stride = dec->edged_width;          int stride = dec->edged_width;
405          int next_block = stride * (reduced_resolution ? 16 : 8);          int next_block = stride * (reduced_resolution ? 16 : 8);
         const int stride2 = stride/2;  
406          int i;          int i;
407          const uint32_t iQuant = pMB->quant;          const uint32_t iQuant = pMB->quant;
408          const int direction = dec->alternate_vertical_scan ? 2 : 0;          const int direction = dec->alternate_vertical_scan ? 2 : 0;
# Line 413  Line 412 
412                          int direction,                          int direction,
413                          const int quant,                          const int quant,
414                          const uint16_t *matrix);                          const uint16_t *matrix);
415            typedef void (*add_residual_function_t)(
416                            uint8_t *predicted_block,
417                            const int16_t *residual,
418                            int stride);
419    
420          const get_inter_block_function_t get_inter_block = (dec->quant_type == 0)          const get_inter_block_function_t get_inter_block = (dec->quant_type == 0)
421                  ? get_inter_block_h263                  ? (get_inter_block_function_t)get_inter_block_h263
422                  : get_inter_block_mpeg;                  : (get_inter_block_function_t)get_inter_block_mpeg;
423    
424          memset(&data[0], 0, 6*64*sizeof(int16_t));      /* clear */          const add_residual_function_t add_residual = (reduced_resolution)
425                    ? (add_residual_function_t)add_upsampled_8x8_16to8
426                    : (add_residual_function_t)transfer_16to8add;
427    
428          for (i = 0; i < 6; i++) {          uint8_t *dst[6];
429            int strides[6];
430    
431    
432            if (dec->interlacing && pMB->field_dct) {
433                    next_block = stride;
434                    stride *= 2;
435            }
436    
437                  if (cbp & (1 << (5 - i))) {     /* coded */          reduced_resolution = !!reduced_resolution;
438            dst[0] = pY_Cur;
439            dst[2] = pY_Cur + next_block;
440            dst[1] = dst[0] + (8<<reduced_resolution);
441            dst[3] = dst[2] + (8<<reduced_resolution);
442            dst[4] = pU_Cur;
443            dst[5] = pV_Cur;
444            strides[0] = strides[1] = strides[2] = strides[3] = stride;
445            strides[4] = stride/2;
446            strides[5] = stride/2;
447    
448            for (i = 0; i < 6; i++) {
449                    /* Process only coded blocks */
450                    if (cbp & (1 << (5 - i))) {
451    
452                            /* Clear the block */
453                            memset(&data[0], 0, 64*sizeof(int16_t));
454    
455                          /* Decode coeffs and dequantize on the fly */                          /* Decode coeffs and dequantize on the fly */
456                          start_timer();                          start_timer();
457                          get_inter_block(bs, &data[i*64], direction, iQuant, get_inter_matrix(dec->mpeg_quant_matrices));                          get_inter_block(bs, &data[0], direction, iQuant, get_inter_matrix(dec->mpeg_quant_matrices));
458                          stop_coding_timer();                          stop_coding_timer();
459    
460                            /* iDCT */
461                          start_timer();                          start_timer();
462                          idct(&data[i * 64]);                          idct(&data[0]);
463                          stop_idct_timer();                          stop_idct_timer();
                 }  
         }  
   
         if (dec->interlacing && pMB->field_dct) {  
                 next_block = stride;  
                 stride *= 2;  
         }  
464    
465                            /* Add this residual to the predicted block */
466          start_timer();          start_timer();
467          if (reduced_resolution) {                          add_residual(dst[i], &data[0], strides[i]);
                 if (cbp & 32)  
                         add_upsampled_8x8_16to8(pY_Cur, &data[0 * 64], stride);  
                 if (cbp & 16)  
                         add_upsampled_8x8_16to8(pY_Cur + 16, &data[1 * 64], stride);  
                 if (cbp & 8)  
                         add_upsampled_8x8_16to8(pY_Cur + next_block, &data[2 * 64], stride);  
                 if (cbp & 4)  
                         add_upsampled_8x8_16to8(pY_Cur + 16 + next_block, &data[3 * 64], stride);  
                 if (cbp & 2)  
                         add_upsampled_8x8_16to8(pU_Cur, &data[4 * 64], stride2);  
                 if (cbp & 1)  
                         add_upsampled_8x8_16to8(pV_Cur, &data[5 * 64], stride2);  
         } else {  
                 if (cbp & 32)  
                         transfer_16to8add(pY_Cur, &data[0 * 64], stride);  
                 if (cbp & 16)  
                         transfer_16to8add(pY_Cur + 8, &data[1 * 64], stride);  
                 if (cbp & 8)  
                         transfer_16to8add(pY_Cur + next_block, &data[2 * 64], stride);  
                 if (cbp & 4)  
                         transfer_16to8add(pY_Cur + 8 + next_block, &data[3 * 64], stride);  
                 if (cbp & 2)  
                         transfer_16to8add(pU_Cur, &data[4 * 64], stride2);  
                 if (cbp & 1)  
                         transfer_16to8add(pV_Cur, &data[5 * 64], stride2);  
         }  
468          stop_transfer_timer();          stop_transfer_timer();
469  }  }
470            }
471    }
472    
473  /* decode an inter macroblock */  /* decode an inter macroblock */
474  static void  static void

Legend:
Removed from v.1.63  
changed lines
  Added in v.1.64

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