q_matrix.c File Reference

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

#include "global.h"
#include "memalloc.h"
#include "q_matrix.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 (ImageParameters *p_Img, char *buf, int bufsize)
void PatchMatrix (ImageParameters *p_Img, InputParameters *p_Inp)
void allocate_QMatrix (QuantParameters *p_Quant, InputParameters *p_Inp)
void free_QMatrix (QuantParameters *p_Quant)
void Init_QMatrix (ImageParameters *p_Img, InputParameters *p_Inp)
void CalculateQuant4x4Param (ImageParameters *p_Img)
void CalculateQuant8x8Param (ImageParameters *p_Img)

Variables

static const int quant_coef [6][4][4]
const int dequant_coef [6][4][4]
static const int quant_coef8 [6][8][8]
static 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]
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 ( QuantParameters *  p_Quant,
InputParameters p_Inp 
)

Allocate Q matrix arrays.

Definition at line 494 of file q_matrix.c.

References get_mem5Dquant(), no_mem_exit(), and inp_par_enc::output.

Referenced by Init_QMatrix().

Here is the call graph for this function:

void CalculateQuant4x4Param ( ImageParameters p_Img  ) 

For calculating the quantisation values at frame level.

Input:
none
Output:
none

Definition at line 578 of file q_matrix.c.

Referenced by code_a_plane().

void CalculateQuant8x8Param ( ImageParameters p_Img  ) 

Calculate the quantisation and inverse quantisation parameters.

Definition at line 734 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 247 of file q_matrix.c.

Referenced by ParseMatrix().

void free_QMatrix ( QuantParameters *  p_Quant  ) 

Free Q matrix arrays.

Definition at line 523 of file q_matrix.c.

References free_mem5Dquant().

Referenced by free_global_buffers().

Here is the call graph for this function:

void Init_QMatrix ( ImageParameters p_Img,
InputParameters p_Inp 
)

Initialise Q matrix values.

Definition at line 539 of file q_matrix.c.

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

Referenced by init_encoder().

Here is the call graph for this function:

void ParseMatrix ( ImageParameters p_Img,
char *  buf,
int  bufsize 
)

Parse the Q matrix values read from cfg file.

Parameters:
p_Img current image parameters
buf buffer to be parsed
bufsize buffer size of buffer

Definition at line 285 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 ( ImageParameters p_Img,
InputParameters p_Inp 
)

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

Definition at line 408 of file q_matrix.c.

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 29 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 172 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 182 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 221 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 209 of file q_matrix.c.

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

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 20 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 201 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 193 of file q_matrix.c.


Documentation generated with DoxyGen