transform8x8.c File Reference

8x8 transform functions More...

#include <math.h>
#include <limits.h>
#include "global.h"
#include "image.h"
#include "mb_access.h"
#include "elements.h"
#include "vlc.h"
#include "transform8x8.h"
#include "transform.h"
#include "macroblock.h"
#include "symbol.h"
#include "mc_prediction.h"
#include "quant8x8.h"
#include "rdoq.h"
#include "q_matrix.h"
#include "q_offsets.h"
#include "rdopt.h"

Include dependency graph for transform8x8.c:

Go to the source code of this file.

Defines

#define P_Z   (PredPel[0])
#define P_A   (PredPel[1])
#define P_B   (PredPel[2])
#define P_C   (PredPel[3])
#define P_D   (PredPel[4])
#define P_E   (PredPel[5])
#define P_F   (PredPel[6])
#define P_G   (PredPel[7])
#define P_H   (PredPel[8])
#define P_I   (PredPel[9])
#define P_J   (PredPel[10])
#define P_K   (PredPel[11])
#define P_L   (PredPel[12])
#define P_M   (PredPel[13])
#define P_N   (PredPel[14])
#define P_O   (PredPel[15])
#define P_P   (PredPel[16])
#define P_Q   (PredPel[17])
#define P_R   (PredPel[18])
#define P_S   (PredPel[19])
#define P_T   (PredPel[20])
#define P_U   (PredPel[21])
#define P_V   (PredPel[22])
#define P_W   (PredPel[23])
#define P_X   (PredPel[24])

Functions

void copy_8x8block (imgpel **oblock, imgpel **iblock, int o_xoffset, int i_xoffset)
int Residual_DPCM_8x8 (int ipmode, int **ores, int **rres, int block_y, int block_x)
int Inv_Residual_DPCM_8x8 (int **m7, int block_y, int block_x)
int Mode_Decision_for_Intra8x8Macroblock (Slice *currSlice, Macroblock *currMB, double lambda, double *min_cost)
int Mode_Decision_for_8x8IntraBlocks_JM_Low (Slice *currSlice, Macroblock *currMB, int b8, double lambda, double *min_cost, int cr_cbp[3])
int Mode_Decision_for_8x8IntraBlocks_JM_High (Slice *currSlice, Macroblock *currMB, int b8, double lambda, double *min_cost, int cr_cbp[3])
static void get_diag_down_left (imgpel **cur_pred, imgpel *PredPel)
static void get_vert_left (imgpel **cur_pred, imgpel *PredPel)
static void get_diag_down_right (imgpel **cur_pred, imgpel *PredPel)
static void get_vert_right (imgpel **cur_pred, imgpel *PredPel)
static void get_hor_down (imgpel **cur_pred, imgpel *PredPel)
static void get_hor_up (imgpel **cur_pred, imgpel *PredPel)
void intrapred_8x8 (Macroblock *currMB, ColorPlane pl, int img_x, int img_y, int *left_available, int *up_available, int *all_available)
void LowPassForIntra8x8Pred (imgpel *PredPel, int block_up_left, int block_up, int block_left)
double RDCost_for_8x8IntraBlocks (Slice *currSlice, Macroblock *currMB, int *nonzero, int b8, int ipmode, double lambda, double min_rdcost, int mostProbableMode, int c_nzCbCr[3])
int dct_8x8 (Macroblock *currMB, ColorPlane pl, int b8, int *coeff_cost, int intra)
int dct_8x8_cavlc (Macroblock *currMB, ColorPlane pl, int b8, int *coeff_cost, int intra)
int dct_8x8_ls (Macroblock *currMB, ColorPlane pl, int b8, int *coeff_cost, int intra)
void compute_comp_cost8x8 (imgpel **cur_img, imgpel **mpr8x8, int pic_opix_x, double *cost)

Variables

static int diff64 [64]
imgpel *** rec8x8
const byte SNGL_SCAN8x8 [64][2]
const byte FIELD_SCAN8x8 [64][2]
static const byte COEFF_COST8x8 [2][64]
static int ** levelscale = NULL
static int ** leveloffset = NULL
static int ** invlevelscale = NULL
static int ** fadjust8x8 = NULL


Detailed Description

8x8 transform functions

Author:
Main contributors (see contributors.h for copyright, address and affiliation details)
Date:
12. October 2003

Definition in file transform8x8.c.


Function Documentation

void compute_comp_cost8x8 ( imgpel **  cur_img,
imgpel **  mpr8x8,
int  pic_opix_x,
double *  cost 
)

distortion for an 8x8 Intra block

Definition at line 1781 of file transform8x8.c.

References distortion8x8().

Referenced by Mode_Decision_for_8x8IntraBlocks_JM_Low().

Here is the call graph for this function:

void copy_8x8block ( imgpel **  oblock,
imgpel **  iblock,
int  o_xoffset,
int  i_xoffset 
)

copy data in 8x8 iblock to oblock

Definition at line 118 of file transform8x8.c.

Referenced by dct_8x8(), dct_8x8_cavlc(), and Mode_Decision_for_8x8IntraBlocks_JM_High().

int dct_8x8 ( Macroblock *  currMB,
ColorPlane  pl,
int  b8,
int *  coeff_cost,
int  intra 
)

The routine performs transform,quantization,inverse transform, adds the diff. to the prediction and writes the result to the decoded luma frame. Includes the RD constrained quantization also.

Input:
b8: Block position inside a macro block (0,1,2,3).
Output:
nonzero: 0 if no levels are nonzero. 1 if there are nonzero levels. coeff_cost: Counter for nonzero coefficients, used to discard expensive levels.

Definition at line 1548 of file transform8x8.c.

References ImageParameters::AdaptiveRounding, macroblock::ar_mode, ImageParameters::ARCofAdj8x8, COEFF_COST8x8, ImageParameters::cofAC, copy_8x8block(), InputParameters::disthres, FIELD_SCAN8x8, macroblock::is_field_mode, ImageParameters::max_imgpel_value, ImageParameters::mb_ores, ImageParameters::mb_pred, ImageParameters::mb_rres, storable_picture::p_curr_img, ImageParameters::pix_x, ImageParameters::pix_y, macroblock::qp_scaled, and SNGL_SCAN8x8.

Here is the call graph for this function:

int dct_8x8_cavlc ( Macroblock *  currMB,
ColorPlane  pl,
int  b8,
int *  coeff_cost,
int  intra 
)

The routine performs transform,quantization,inverse transform, adds the diff. to the prediction and writes the result to the decoded luma frame. Includes the RD constrained quantization also. Used for CAVLC.

Input:
b8: Block position inside a macro block (0,1,2,3).
Output:
nonzero: 0 if no levels are nonzero. 1 if there are nonzero levels. coeff_cost: Counter for nonzero coefficients, used to discard expensive levels.

Definition at line 1614 of file transform8x8.c.

References ImageParameters::AdaptiveRounding, macroblock::ar_mode, ImageParameters::ARCofAdj8x8, COEFF_COST8x8, ImageParameters::cofAC, copy_8x8block(), InputParameters::disthres, FIELD_SCAN8x8, macroblock::is_field_mode, ImageParameters::max_imgpel_value, ImageParameters::mb_ores, ImageParameters::mb_pred, ImageParameters::mb_rres, storable_picture::p_curr_img, ImageParameters::pix_x, ImageParameters::pix_y, macroblock::qp_scaled, and SNGL_SCAN8x8.

Here is the call graph for this function:

void intrapred_8x8 ( Macroblock *  currMB,
ColorPlane  pl,
int  img_x,
int  img_y,
int *  left_available,
int *  up_available,
int *  all_available 
)

Make intra 8x8 prediction according to all 9 prediction modes. The routine uses left and upper neighbouring points from previous coded blocks to do this (if available). Notice that inaccessible neighbouring points are signalled with a negative value in the predmode array .

Input:
Starting point of current 8x8 block image posision
Output:
none

Definition at line 1117 of file transform8x8.c.

References pix_pos::available, ImageParameters::dc_pred_value, ImageParameters::intra_block, LowPassForIntra8x8Pred(), pix_pos::mb_addr, ImageParameters::mb_size, ImageParameters::mpr_8x8, storable_picture::p_curr_img, pix_pos::pos_x, pix_pos::pos_y, and InputParameters::UseConstrainedIntraPred.

Referenced by Mode_Decision_for_8x8IntraBlocks_JM_High(), and Mode_Decision_for_8x8IntraBlocks_JM_Low().

Here is the call graph for this function:

int Inv_Residual_DPCM_8x8 ( int **  m7,
int  block_y,
int  block_x 
)

Inverse residual DPCM for Intra lossless coding.

Input:
block_x,block_y: Block position inside a macro block (0,8).

Definition at line 182 of file transform8x8.c.

void LowPassForIntra8x8Pred ( imgpel *  PredPel,
int  block_up_left,
int  block_up,
int  block_left 
)

Prefiltering for Intra8x8 prediction.

Definition at line 1351 of file transform8x8.c.

Referenced by intrapred_8x8().

int Mode_Decision_for_8x8IntraBlocks_JM_High ( Slice *  currSlice,
Macroblock *  currMB,
int  b8,
double  lambda,
double *  min_cost,
int  cr_cbp[3] 
)

int Mode_Decision_for_8x8IntraBlocks_JM_Low ( Slice *  currSlice,
Macroblock *  currMB,
int  b8,
double  lambda,
double *  min_cost,
int  cr_cbp[3] 
)

int Mode_Decision_for_Intra8x8Macroblock ( Slice *  currSlice,
Macroblock *  currMB,
double  lambda,
double *  min_cost 
)

8x8 Intra mode decision for a macroblock

Definition at line 245 of file transform8x8.c.

References ImageParameters::P444_joined.

Referenced by encode_one_macroblock_low(), and RDCost_for_macroblocks().

double RDCost_for_8x8IntraBlocks ( Slice *  currSlice,
Macroblock *  currMB,
int *  nonzero,
int  b8,
int  ipmode,
double  lambda,
double  min_rdcost,
int  mostProbableMode,
int  c_nzCbCr[3] 
)

int Residual_DPCM_8x8 ( int  ipmode,
int **  ores,
int **  rres,
int  block_y,
int  block_x 
)

Residual DPCM for Intra lossless coding.

Input:
block_x,block_y: Block position inside a macro block (0,8).

Definition at line 137 of file transform8x8.c.


Variable Documentation

const byte COEFF_COST8x8[2][64] [static]

Initial value:

{
  {3,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,
   1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
   9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
   9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
   9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9}
}
array used to find expensive coefficients

Definition at line 68 of file transform8x8.c.

Referenced by dct_8x8(), and dct_8x8_cavlc().

const byte FIELD_SCAN8x8[64][2]

Initial value:

 {   
  {0,0}, {0,1}, {0,2}, {1,0}, {1,1}, {0,3}, {0,4}, {1,2},
  {2,0}, {1,3}, {0,5}, {0,6}, {0,7}, {1,4}, {2,1}, {3,0},
  {2,2}, {1,5}, {1,6}, {1,7}, {2,3}, {3,1}, {4,0}, {3,2},
  {2,4}, {2,5}, {2,6}, {2,7}, {3,3}, {4,1}, {5,0}, {4,2},
  {3,4}, {3,5}, {3,6}, {3,7}, {4,3}, {5,1}, {6,0}, {5,2},
  {4,4}, {4,5}, {4,6}, {4,7}, {5,3}, {6,1}, {6,2}, {5,4},
  {5,5}, {5,6}, {5,7}, {6,3}, {7,0}, {7,1}, {6,4}, {6,5},
  {6,6}, {6,7}, {7,2}, {7,3}, {7,4}, {7,5}, {7,6}, {7,7}
}
field scan pattern

Definition at line 55 of file transform8x8.c.

Referenced by dct_8x8(), and dct_8x8_cavlc().

const byte SNGL_SCAN8x8[64][2]

Initial value:

 {
  {0,0}, {1,0}, {0,1}, {0,2}, {1,1}, {2,0}, {3,0}, {2,1},
  {1,2}, {0,3}, {0,4}, {1,3}, {2,2}, {3,1}, {4,0}, {5,0},
  {4,1}, {3,2}, {2,3}, {1,4}, {0,5}, {0,6}, {1,5}, {2,4},
  {3,3}, {4,2}, {5,1}, {6,0}, {7,0}, {6,1}, {5,2}, {4,3},
  {3,4}, {2,5}, {1,6}, {0,7}, {1,7}, {2,6}, {3,5}, {4,4},
  {5,3}, {6,2}, {7,1}, {7,2}, {6,3}, {5,4}, {4,5}, {3,6},
  {2,7}, {3,7}, {4,6}, {5,5}, {6,4}, {7,3}, {7,4}, {6,5},
  {5,6}, {4,7}, {5,7}, {6,6}, {7,5}, {7,6}, {6,7}, {7,7}
}
single scan pattern

Definition at line 42 of file transform8x8.c.

Referenced by dct_8x8(), and dct_8x8_cavlc().


Documentation generated with DoxyGen