q_offsets.c File Reference

read Quantization Offset matrix parameters from input file: q_OffsetMatrix.cfg More...

#include "global.h"
#include "memalloc.h"
#include "q_matrix.h"
#include "q_offsets.h"

Include dependency graph for q_offsets.c:

Go to the source code of this file.

Defines

#define MAX_ITEMS_TO_PARSE   2000

Functions

char * GetConfigFileContent (char *Filename, int error_type)
static void InitOffsetParam (QuantParameters *p_Quant, InputParameters *p_Inp)
static void allocate_QOffsets (QuantParameters *p_Quant, InputParameters *p_Inp)
static void update_q_offset4x4 (LevelQuantParams **q_params, short *offsetList, int q_bits)
static void update_q_offset8x8 (LevelQuantParams **q_params, short *offsetList, int q_bits)
void free_QOffsets (QuantParameters *p_Quant, InputParameters *p_Inp)
int CheckOffsetParameterName (char *s, int *type)
void ParseQOffsetMatrix (QuantParameters *p_Quant, char *buf, int bufsize)
void Init_QOffsetMatrix (ImageParameters *p_Img, InputParameters *p_Inp)
void CalculateOffset4x4Param (ImageParameters *p_Img, InputParameters *p_Inp)
void CalculateOffset8x8Param (ImageParameters *p_Img, InputParameters *p_Inp)

Variables

int offset4x4_check [6] = { 0, 0, 0, 0, 0, 0 }
int offset8x8_check [6] = { 0, 0, 0, 0, 0, 0 }
static const char OffsetType4x4 [15][24]
static const char OffsetType8x8 [15][24]
static const short Offset_intra_default_intra [16]
static const short Offset_intra_default_chroma [16]
static const short Offset_intra_default_inter [16]
static const short Offset_inter_default [16]
static const short Offset8_intra_default_intra [64]
static const short Offset8_intra_default_chroma [64]
static const short Offset8_intra_default_inter [64]
static const short Offset8_inter_default [64]


Detailed Description

read Quantization Offset matrix parameters from input file: q_OffsetMatrix.cfg

Definition in file q_offsets.c.


Function Documentation

static void allocate_QOffsets ( QuantParameters *  p_Quant,
InputParameters p_Inp 
) [static]

Allocate Q matrix arrays.

Definition at line 142 of file q_offsets.c.

References inp_par_enc::AdaptRoundingFixed, get_mem2Dshort(), get_mem3Dshort(), and inp_par_enc::output.

Referenced by Init_QOffsetMatrix().

Here is the call graph for this function:

void CalculateOffset4x4Param ( ImageParameters p_Img,
InputParameters p_Inp 
)

Calculation of the quantization offset parameters at the frame level.

Input:
none
Output:
none

Definition at line 497 of file q_offsets.c.

References inp_par_enc::AdaptRndCrWFactor, inp_par_enc::AdaptRndWFactor, and inp_par_enc::AdaptRoundingFixed.

Referenced by code_a_plane(), encode_one_slice(), and encode_one_slice_MBAFF().

void CalculateOffset8x8Param ( ImageParameters p_Img,
InputParameters p_Inp 
)

Calculate the quantisation offset parameters.

Definition at line 581 of file q_offsets.c.

References inp_par_enc::AdaptRoundingFixed.

Referenced by code_a_plane(), encode_one_slice(), and encode_one_slice_MBAFF().

int CheckOffsetParameterName ( char *  s,
int *  type 
)

Check the parameter name.

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

Definition at line 228 of file q_offsets.c.

Referenced by ParseQOffsetMatrix().

void free_QOffsets ( QuantParameters *  p_Quant,
InputParameters p_Inp 
)

Free Q matrix arrays.

Definition at line 196 of file q_offsets.c.

References inp_par_enc::AdaptRoundingFixed, free_mem2Dshort(), and free_mem3Dshort().

Referenced by free_global_buffers().

Here is the call graph for this function:

void Init_QOffsetMatrix ( ImageParameters p_Img,
InputParameters p_Inp 
)

Initialise Q offset matrix values.

Now set up all offset p_Inp. This process could be reused if we wish to re-init offsets

Definition at line 394 of file q_offsets.c.

References allocate_QOffsets(), errortext, GetConfigFileContent(), InitOffsetParam(), inp_par_enc::OffsetMatrixPresentFlag, ParseQOffsetMatrix(), and inp_par_enc::QOffsetMatrixFile.

Referenced by init_encoder().

Here is the call graph for this function:

static void InitOffsetParam ( QuantParameters *  p_Quant,
InputParameters p_Inp 
) [static]

Init quantization offset parameters.

Input:
none
Output:
none

Definition at line 436 of file q_offsets.c.

References inp_par_enc::AdaptRoundingFixed, inp_par_enc::OffsetMatrixPresentFlag, and inp_par_enc::output.

Referenced by Init_QOffsetMatrix().

void ParseQOffsetMatrix ( QuantParameters *  p_Quant,
char *  buf,
int  bufsize 
)

Parse the Q Offset Matrix values read from cfg file.

Parameters:
p_Quant quantization parameters
buf buffer to be parsed
bufsize buffer size of buffer

Definition at line 266 of file q_offsets.c.

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

Referenced by Init_QOffsetMatrix().

Here is the call graph for this function:


Variable Documentation

const short Offset8_inter_default[64] [static]

Initial value:

 {
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342
}

Definition at line 122 of file q_offsets.c.

const short Offset8_intra_default_chroma[64] [static]

Initial value:

 {
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682
}

Definition at line 100 of file q_offsets.c.

const short Offset8_intra_default_inter[64] [static]

Initial value:

 {
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342,
  342, 342, 342, 342, 342, 342, 342, 342
}

Definition at line 111 of file q_offsets.c.

const short Offset8_intra_default_intra[64] [static]

Initial value:

 {
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682,
  682, 682, 682, 682, 682, 682, 682, 682
}

Definition at line 89 of file q_offsets.c.

const short Offset_inter_default[16] [static]

Initial value:

 {
  342, 342, 342, 342,
  342, 342, 342, 342,
  342, 342, 342, 342,
  342, 342, 342, 342,
}

Definition at line 82 of file q_offsets.c.

const short Offset_intra_default_chroma[16] [static]

Initial value:

 {
  682, 682, 682, 682,
  682, 682, 682, 682,
  682, 682, 682, 682,
  682, 682, 682, 682
}

Definition at line 67 of file q_offsets.c.

const short Offset_intra_default_inter[16] [static]

Initial value:

 {
  342, 342, 342, 342,
  342, 342, 342, 342,
  342, 342, 342, 342,
  342, 342, 342, 342,
}

Definition at line 75 of file q_offsets.c.

const short Offset_intra_default_intra[16] [static]

Initial value:

 {
  682, 682, 682, 682,
  682, 682, 682, 682,
  682, 682, 682, 682,
  682, 682, 682, 682
}

Definition at line 60 of file q_offsets.c.

const char OffsetType4x4[15][24] [static]

Initial value:

 {
  "INTRA4X4_LUMA_INTRA",
  "INTRA4X4_CHROMAU_INTRA",
  "INTRA4X4_CHROMAV_INTRA",
  "INTRA4X4_LUMA_INTERP",
  "INTRA4X4_CHROMAU_INTERP",
  "INTRA4X4_CHROMAV_INTERP",
  "INTRA4X4_LUMA_INTERB",
  "INTRA4X4_CHROMAU_INTERB",
  "INTRA4X4_CHROMAV_INTERB",
  "INTER4X4_LUMA_INTERP",
  "INTER4X4_CHROMAU_INTERP",
  "INTER4X4_CHROMAV_INTERP",
  "INTER4X4_LUMA_INTERB",
  "INTER4X4_CHROMAU_INTERB",
  "INTER4X4_CHROMAV_INTERB"
}

Definition at line 24 of file q_offsets.c.

const char OffsetType8x8[15][24] [static]

Initial value:

 {
  "INTRA8X8_LUMA_INTRA",
  "INTRA8X8_LUMA_INTERP",
  "INTRA8X8_LUMA_INTERB",
  "INTER8X8_LUMA_INTERP",
  "INTER8X8_LUMA_INTERB",
  "INTRA8X8_CHROMAU_INTRA",
  "INTRA8X8_CHROMAU_INTERP",
  "INTRA8X8_CHROMAU_INTERB",
  "INTER8X8_CHROMAU_INTERP",
  "INTER8X8_CHROMAU_INTERB",
  "INTRA8X8_CHROMAV_INTRA",
  "INTRA8X8_CHROMAV_INTERP",
  "INTRA8X8_CHROMAV_INTERB",
  "INTER8X8_CHROMAV_INTERP",
  "INTER8X8_CHROMAV_INTERB"
}

Definition at line 42 of file q_offsets.c.


Documentation generated with DoxyGen