q_matrix.c File Reference

read q_matrix parameters from input file: q_matrix.cfg More...

#include "global.h"
#include "memalloc.h"

Include dependency graph for q_matrix.c:

Go to the source code of this file.

Defines

#define MAX_ITEMS_TO_PARSE   1000

Functions

char * GetConfigFileContent (char *Filename, int error_type)
int CheckParameterName (char *s, int *type)
void ParseMatrix (char *buf, int bufsize)
void PatchMatrix (void)
void allocate_QMatrix (void)
void free_QMatrix ()
void Init_QMatrix (void)
void CalculateQuantParam (void)
void CalculateQuant8Param ()

Variables

const int quant_coef [6][4][4]
const int dequant_coef [6][4][4]
const int quant_coef8 [6][8][8]
const int dequant_coef8 [6][8][8]
int matrix4x4_check [6] = {0, 0, 0, 0, 0, 0}
int matrix8x8_check [6] = {0, 0, 0, 0, 0, 0}
static const char MatrixType4x4 [6][20]
static const char MatrixType8x8 [6][20]
int ***** LevelScale4x4Comp
int ***** LevelScale8x8Comp
int ***** InvLevelScale4x4Comp
int ***** InvLevelScale8x8Comp
short ScalingList4x4input [6][16]
short ScalingList8x8input [6][64]
short ScalingList4x4 [6][16]
short ScalingList8x8 [6][64]
short UseDefaultScalingMatrix4x4Flag [6]
short UseDefaultScalingMatrix8x8Flag [6]
int * qp_per_matrix
int * qp_rem_matrix
static const short Quant_intra_default [16]
static const short Quant_inter_default [16]
static const short Quant8_intra_default [64]
static const short Quant8_inter_default [64]


Detailed Description

read q_matrix parameters from input file: q_matrix.cfg

Definition in file q_matrix.c.


Function Documentation

void allocate_QMatrix ( void   ) 

Allocate Q matrix arrays.

Definition at line 505 of file q_matrix.c.

References get_mem5Dint(), no_mem_exit(), and InputParameters::output.

Referenced by Init_QMatrix().

Here is the call graph for this function:

void CalculateQuant8Param ( void   ) 

Calculate the quantisation and inverse quantisation parameters.

Definition at line 730 of file q_matrix.c.

Referenced by code_a_plane().

void CalculateQuantParam ( void   ) 

For calculating the quantisation values at frame level.

Input:
none
Output:
none

Definition at line 591 of file q_matrix.c.

Referenced by code_a_plane().

int CheckParameterName ( char *  s,
int *  type 
)

Check the parameter name.

Parameters:
s parameter name string
type 4x4 or 8x8 matrix type
Returns:
the index number if the string is a valid parameter name,
-1 for error

Definition at line 262 of file q_matrix.c.

Referenced by ParseMatrix().

void free_QMatrix ( void   ) 

Free Q matrix arrays.

Definition at line 534 of file q_matrix.c.

References free_mem5Dint().

Referenced by free_global_buffers().

Here is the call graph for this function:

void Init_QMatrix ( void   ) 

Initialise Q matrix values.

Definition at line 553 of file q_matrix.c.

References allocate_QMatrix(), errortext, GetConfigFileContent(), ParseMatrix(), PatchMatrix(), InputParameters::QmatrixFile, and InputParameters::ScalingMatrixPresentFlag.

Referenced by init_encoder().

Here is the call graph for this function:

void ParseMatrix ( char *  buf,
int  bufsize 
)

Parse the Q matrix values read from cfg file.

Parameters:
buf buffer to be parsed
bufsize buffer size of buffer

Definition at line 298 of file q_matrix.c.

References CheckParameterName(), error(), errortext, and ET_SIZE.

Referenced by Init_QMatrix().

Here is the call graph for this function:

void PatchMatrix ( void   ) 

Check Q Matrix values. If invalid values found in matrix, whole matrix will be patch with default value 16.

Definition at line 420 of file q_matrix.c.

References InputParameters::ScalingListPresentFlag.

Referenced by Init_QMatrix().


Variable Documentation

const int dequant_coef[6][4][4]

Initial value:

 {
  {{10, 13, 10, 13},{ 13, 16, 13, 16},{10, 13, 10, 13},{ 13, 16, 13, 16}},
  {{11, 14, 11, 14},{ 14, 18, 14, 18},{11, 14, 11, 14},{ 14, 18, 14, 18}},
  {{13, 16, 13, 16},{ 16, 20, 16, 20},{13, 16, 13, 16},{ 16, 20, 16, 20}},
  {{14, 18, 14, 18},{ 18, 23, 18, 23},{14, 18, 14, 18},{ 18, 23, 18, 23}},
  {{16, 20, 16, 20},{ 20, 25, 20, 25},{16, 20, 16, 20},{ 20, 25, 20, 25}},
  {{18, 23, 18, 23},{ 23, 29, 23, 29},{18, 23, 18, 23},{ 23, 29, 23, 29}}
}

Definition at line 28 of file q_matrix.c.

const char MatrixType4x4[6][20] [static]

Initial value:

{
  "INTRA4X4_LUMA",
  "INTRA4X4_CHROMAU",
  "INTRA4X4_CHROMAV",
  "INTER4X4_LUMA",
  "INTER4X4_CHROMAU",
  "INTER4X4_CHROMAV"
}

Definition at line 171 of file q_matrix.c.

const char MatrixType8x8[6][20] [static]

Initial value:

{
  "INTRA8X8_LUMA",
  "INTER8X8_LUMA",
  "INTRA8X8_CHROMAU",  
  "INTER8X8_CHROMAU",  
  "INTRA8X8_CHROMAV",  
  "INTER8X8_CHROMAV"   
}

Definition at line 181 of file q_matrix.c.

const short Quant8_inter_default[64] [static]

Initial value:

{
 9,13,15,17,19,21,22,24,
13,13,17,19,21,22,24,25,
15,17,19,21,22,24,25,27,
17,19,21,22,24,25,27,28,
19,21,22,24,25,27,28,30,
21,22,24,25,27,28,30,32,
22,24,25,27,28,30,32,33,
24,25,27,28,30,32,33,35
}

Definition at line 236 of file q_matrix.c.

const short Quant8_intra_default[64] [static]

Initial value:

{
 6,10,13,16,18,23,25,27,
10,11,16,18,23,25,27,29,
13,16,18,23,25,27,29,31,
16,18,23,25,27,29,31,33,
18,23,25,27,29,31,33,36,
23,25,27,29,31,33,36,38,
25,27,29,31,33,36,38,40,
27,29,31,33,36,38,40,42
}

Definition at line 224 of file q_matrix.c.

const int quant_coef[6][4][4]

Initial value:

 {
  {{13107, 8066,13107, 8066},{ 8066, 5243, 8066, 5243},{13107, 8066,13107, 8066},{ 8066, 5243, 8066, 5243}},
  {{11916, 7490,11916, 7490},{ 7490, 4660, 7490, 4660},{11916, 7490,11916, 7490},{ 7490, 4660, 7490, 4660}},
  {{10082, 6554,10082, 6554},{ 6554, 4194, 6554, 4194},{10082, 6554,10082, 6554},{ 6554, 4194, 6554, 4194}},
  {{ 9362, 5825, 9362, 5825},{ 5825, 3647, 5825, 3647},{ 9362, 5825, 9362, 5825},{ 5825, 3647, 5825, 3647}},
  {{ 8192, 5243, 8192, 5243},{ 5243, 3355, 5243, 3355},{ 8192, 5243, 8192, 5243},{ 5243, 3355, 5243, 3355}},
  {{ 7282, 4559, 7282, 4559},{ 4559, 2893, 4559, 2893},{ 7282, 4559, 7282, 4559},{ 4559, 2893, 4559, 2893}}
}

Definition at line 19 of file q_matrix.c.

const short Quant_inter_default[16] [static]

Initial value:

{
10,14,20,24,
14,20,24,27,
20,24,27,30,
24,27,30,34
}

Definition at line 216 of file q_matrix.c.

const short Quant_intra_default[16] [static]

Initial value:

{
 6,13,20,28,
13,20,28,32,
20,28,32,37,
28,32,37,42
}

Definition at line 208 of file q_matrix.c.


Documentation generated with DoxyGen