OpenCores
URL https://opencores.org/ocsvn/bluespec-h264/bluespec-h264/trunk

Subversion Repositories bluespec-h264

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /bluespec-h264/trunk/test/decoder/ldecod/inc
    from Rev 14 to Rev 100
    Reverse comparison

Rev 14 → Rev 100

/memalloc.h
0,0 → 1,55
 
/*!
************************************************************************
* \file memalloc.h
*
* \brief
* Memory allocation and free helper funtions
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
************************************************************************
*/
 
#ifndef _MEMALLOC_H_
#define _MEMALLOC_H_
 
#include "global.h"
 
int get_mem2D(byte ***array2D, int rows, int columns);
int get_mem3D(byte ****array2D, int frames, int rows, int columns);
 
int get_mem2Dint(int ***array2D, int rows, int columns);
int get_mem3Dint(int ****array3D, int frames, int rows, int columns);
int get_mem4Dint(int *****array4D, int idx, int frames, int rows, int columns );
 
int get_mem3Dint64(int64 ****array3D, int frames, int rows, int columns);
int get_mem2Dint64(int64 ***array2D, int rows, int columns);
 
int get_mem2Dshort(short ***array2D, int rows, int columns);
int get_mem3Dshort(short ****array3D, int frames, int rows, int columns);
int get_mem4Dshort(short *****array4D, int idx, int frames, int rows, int columns );
 
int get_mem2Dpel(imgpel ***array2D, int rows, int columns);
int get_mem3Dpel(imgpel ****array3D, int frames, int rows, int columns);
 
void free_mem2D(byte **array2D);
void free_mem3D(byte ***array2D, int frames);
 
void free_mem2Dint(int **array2D);
void free_mem3Dint(int ***array3D, int frames);
void free_mem4Dint(int ****array4D, int idx, int frames);
 
void free_mem2Dint64(int64 **array2D);
void free_mem3Dint64(int64 ***array3D64, int frames);
 
void free_mem2Dshort(short **array2D);
void free_mem3Dshort(short ***array3D, int frames);
void free_mem4Dshort(short ****array4D, int idx, int frames);
 
void free_mem2Dpel(imgpel **array2D);
void free_mem3Dpel(imgpel ***array3D, int frames);
 
void no_mem_exit(char *where);
 
#endif
/cabac.h
0,0 → 1,54
 
/*!
***************************************************************************
* \file
* cabac.h
*
* \brief
* Headerfile for entropy coding routines
*
* \author
* Detlev Marpe \n
* Copyright (C) 2000 HEINRICH HERTZ INSTITUTE All Rights Reserved.
*
* \date
* 21. Oct 2000 (Changes by Tobias Oelbaum 28.08.2001)
***************************************************************************
*/
 
#ifndef _CABAC_H_
#define _CABAC_H_
 
#include "global.h"
 
MotionInfoContexts* create_contexts_MotionInfo(void);
TextureInfoContexts* create_contexts_TextureInfo(void);
void init_contexts_MotionInfo(struct img_par *img, MotionInfoContexts *enco_ctx);
void init_contexts_TextureInfo(struct img_par *img, TextureInfoContexts *enco_ctx);
void delete_contexts_MotionInfo(MotionInfoContexts *enco_ctx);
void delete_contexts_TextureInfo(TextureInfoContexts *enco_ctx);
 
void cabac_new_slice();
 
void readMB_typeInfo_CABAC(SyntaxElement *se, struct img_par *img, DecodingEnvironmentPtr dep_dp);
void readB8_typeInfo_CABAC(SyntaxElement *se, struct img_par *img, DecodingEnvironmentPtr dep_dp);
void readIntraPredMode_CABAC(SyntaxElement *se, struct img_par *img, DecodingEnvironmentPtr dep_dp);
void readRefFrame_CABAC(SyntaxElement *se, struct img_par *img, DecodingEnvironmentPtr dep_dp);
void readMVD_CABAC(SyntaxElement *se, struct img_par *img, DecodingEnvironmentPtr dep_dp);
void readCBP_CABAC(SyntaxElement *se, struct img_par *img, DecodingEnvironmentPtr dep_dp);
void readRunLevel_CABAC(SyntaxElement *se, struct img_par *img, DecodingEnvironmentPtr dep_dp);
void readDquant_CABAC(SyntaxElement *se,struct img_par *img,DecodingEnvironmentPtr dep_dp);
void readCIPredMode_CABAC(SyntaxElement *se,struct img_par *img,DecodingEnvironmentPtr dep_dp);
void readMB_skip_flagInfo_CABAC( SyntaxElement *se, struct img_par *img, DecodingEnvironmentPtr dep_dp);
void readFieldModeInfo_CABAC(SyntaxElement *se, struct img_par *img,DecodingEnvironmentPtr dep_dp);
 
void readMB_transform_size_flag_CABAC( SyntaxElement *se, struct img_par *img, DecodingEnvironmentPtr dep_dp);
 
int readSyntaxElement_CABAC(SyntaxElement *se, struct img_par *img, DataPartition *this_dataPart);
 
int check_next_mb_and_get_field_mode_CABAC(SyntaxElement *se,struct img_par *img,DataPartition *act_dp);
void CheckAvailabilityOfNeighborsCABAC();
 
 
#endif // _CABAC_H_
 
/block.h
0,0 → 1,31
 
/*!
************************************************************************
* \file block.h
*
* \brief
* definitions for block decoding functions
*
* \author
* Inge Lille-Langoy <inge.lille-langoy@telenor.com> \n
* Telenor Satellite Services \n
* P.O.Box 6914 St.Olavs plass \n
* N-0130 Oslo, Norway
*
************************************************************************
*/
 
#ifndef _BLOCK_H_
#define _BLOCK_H_
 
#include "global.h"
 
#define DQ_BITS 6
 
extern const byte QP_SCALE_CR[52] ;
extern const int dequant_coef[6][4][4];
extern const unsigned char subblk_offset_x[3][8][4];
extern const unsigned char subblk_offset_y[3][8][4];
 
#endif
 
/erc_do.h
0,0 → 1,44
 
/*!
************************************************************************
* \file erc_do.h
*
* \brief
* Header for the I & P frame error concealment common functions
*
* \author
* - Viktor Varsa <viktor.varsa@nokia.com>
* - Ye-Kui Wang <wyk@ieee.org>
*
************************************************************************
*/
 
#ifndef _ERC_DO_H_
#define _ERC_DO_H_
 
 
#include "erc_api.h"
 
void ercPixConcealIMB(imgpel *currFrame, int row, int column, int predBlocks[], int frameWidth, int mbWidthInBlocks);
 
int ercCollect8PredBlocks( int predBlocks[], int currRow, int currColumn, int *condition,
int maxRow, int maxColumn, int step, byte fNoCornerNeigh );
int ercCollectColumnBlocks( int predBlocks[], int currRow, int currColumn, int *condition, int maxRow, int maxColumn, int step );
 
#define isSplitted(object_list,currMBNum) \
((object_list+((currMBNum)<<2))->regionMode >= REGMODE_SPLITTED)
 
/* this can be used as isBlock(...,INTRA) or isBlock(...,INTER_COPY) */
#define isBlock(object_list,currMBNum,comp,regMode) \
(isSplitted(object_list,currMBNum) ? \
((object_list+((currMBNum)<<2)+(comp))->regionMode == REGMODE_##regMode##_8x8) : \
((object_list+((currMBNum)<<2))->regionMode == REGMODE_##regMode))
 
/* this can be used as getParam(...,mv) or getParam(...,xMin) or getParam(...,yMin) */
#define getParam(object_list,currMBNum,comp,param) \
(isSplitted(object_list,currMBNum) ? \
((object_list+((currMBNum)<<2)+(comp))->param) : \
((object_list+((currMBNum)<<2))->param))
 
#endif
 
/parset.h
0,0 → 1,44
 
/*!
**************************************************************************************
* \file
* parset.h
* \brief
* Picture and Sequence Parameter Sets, decoder operations
* This code reflects JVT version xxx
* \date 25 November 2002
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Stephan Wenger <stewe@cs.tu-berlin.de>
***************************************************************************************
*/
#ifndef _PARSET_H_
#define _PARSET_H_
 
 
#include "parsetcommon.h"
#include "nalucommon.h"
 
void Scaling_List(int *scalingList, int sizeOfScalingList, Boolean *UseDefaultScalingMatrix, Bitstream *s);
 
void InitVUI(seq_parameter_set_rbsp_t *sps);
int ReadVUI(DataPartition *p, seq_parameter_set_rbsp_t *sps);
int ReadHRDParameters(DataPartition *p, hrd_parameters_t *hrd);
 
void PPSConsistencyCheck (pic_parameter_set_rbsp_t *pps);
void SPSConsistencyCheck (seq_parameter_set_rbsp_t *sps);
 
void MakePPSavailable (int id, pic_parameter_set_rbsp_t *pps);
void MakeSPSavailable (int id, seq_parameter_set_rbsp_t *sps);
 
void ProcessSPS (NALU_t *nalu);
void ProcessPPS (NALU_t *nalu);
 
void UseParameterSet (int PicParsetId);
 
void CleanUpPPS();
 
void activate_sps (seq_parameter_set_rbsp_t *sps);
void activate_pps (pic_parameter_set_rbsp_t *pps);
 
#endif
/nalu.h
0,0 → 1,28
 
/*!
**************************************************************************************
* \file
* parset.h
* \brief
* Picture and Sequence Parameter Sets, encoder operations
* This code reflects JVT version xxx
* \date 25 November 2002
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Stephan Wenger <stewe@cs.tu-berlin.de>
***************************************************************************************
*/
 
 
#ifndef _NALU_H_
#define _NALU_H_
 
#include <stdio.h>
#include "nalucommon.h"
 
extern FILE *bits;
 
int GetAnnexbNALU (NALU_t *nalu);
int NALUtoRBSP (NALU_t *nalu);
 
#endif
/output.h
0,0 → 1,27
 
/*!
**************************************************************************************
* \file
* output.h
* \brief
* Picture writing routine headers
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Karsten Suehring <suehring@hhi.de>
***************************************************************************************
*/
#ifndef _OUTPUT_H_
#define _OUTPUT_H_
 
int testEndian();
 
void write_stored_frame(FrameStore *fs, int p_out);
void direct_output(StorablePicture *p, int p_out);
void init_out_buffer();
void uninit_out_buffer();
 
#ifdef PAIR_FIELDS_IN_OUTPUT
void flush_pending_output(int p_out);
#endif
 
#endif //_OUTPUT_H_
/leaky_bucket.h
0,0 → 1,26
 
/*!
*************************************************************************************
* \file leaky_bucket.h
*
* \brief
* Header for Leaky Buffer parameters
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Shankar Regunathan <shanre@microsoft.com>
*************************************************************************************
*/
#ifndef _LEAKY_BUCKET_H_
#define _LEAKY_BUCKET_H_
 
#include "global.h"
 
#ifdef _LEAKYBUCKET_
// Leaky Bucket functions
unsigned long GetBigDoubleWord(FILE *fp);
void calc_buffer(struct inp_par *inp);
#endif
 
#endif
 
/erc_api.h
0,0 → 1,166
 
/*!
************************************************************************
* \file erc_api.h
*
* \brief
* External (still inside video decoder) interface for error concealment module
*
* \author
* - Ari Hourunranta <ari.hourunranta@nokia.com>
* - Ye-Kui Wang <wyk@ieee.org>
* - Jill Boyce <jill.boyce@thomson.net>
* - Saurav K Bandyopadhyay <saurav@ieee.org>
* - Zhenyu Wu <Zhenyu.Wu@thomson.net
* - Purvin Pandit <Purvin.Pandit@thomson.net>
*
* ************************************************************************
*/
 
 
#ifndef _ERC_API_H_
#define _ERC_API_H_
 
#include "erc_globals.h"
 
/*
* Defines
*/
 
/* If the average motion vector of the correctly received macroblocks is less than the
threshold, concealByCopy is used, otherwise concealByTrial is used. */
#define MVPERMB_THR 8
 
/* used to determine the size of the allocated memory for a temporal Region (MB) */
#define DEF_REGION_SIZE 384 /* 8*8*6 */
 
#define ERC_BLOCK_OK 3
#define ERC_BLOCK_CONCEALED 2
#define ERC_BLOCK_CORRUPTED 1
#define ERC_BLOCK_EMPTY 0
 
#define mabs(a) ( (a) < 0 ? -(a) : (a) )
#define mmax(a,b) ((a) > (b) ? (a) : (b))
#define mmin(a,b) ((a) < (b) ? (a) : (b))
 
/*
* Functions to convert MBNum representation to blockNum
*/
 
#define xPosYBlock(currYBlockNum,picSizeX) \
((currYBlockNum)%((picSizeX)>>3))
 
#define yPosYBlock(currYBlockNum,picSizeX) \
((currYBlockNum)/((picSizeX)>>3))
 
#define xPosMB(currMBNum,picSizeX) \
((currMBNum)%((picSizeX)>>4))
 
#define yPosMB(currMBNum,picSizeX) \
((currMBNum)/((picSizeX)>>4))
 
#define MBxy2YBlock(currXPos,currYPos,comp,picSizeX) \
((((currYPos)<<1)+((comp)>>1))*((picSizeX)>>3)+((currXPos)<<1)+((comp)&1))
 
#define MBNum2YBlock(currMBNum,comp,picSizeX) \
MBxy2YBlock(xPosMB((currMBNum),(picSizeX)),yPosMB((currMBNum),(picSizeX)),(comp),(picSizeX))
 
 
/*
* typedefs
*/
 
/* segment data structure */
typedef struct ercSegment_s
{
int startMBPos;
int endMBPos;
int fCorrupted;
} ercSegment_t;
 
/* Error detector & concealment instance data structure */
typedef struct ercVariables_s
{
/* Number of macroblocks (size or size/4 of the arrays) */
int nOfMBs;
/* Number of segments (slices) in frame */
int nOfSegments;
 
/* Array for conditions of Y blocks */
int *yCondition;
/* Array for conditions of U blocks */
int *uCondition;
/* Array for conditions of V blocks */
int *vCondition;
 
/* Array for Slice level information */
ercSegment_t *segments;
int currSegment;
 
/* Conditions of the MBs of the previous frame */
int *prevFrameYCondition;
 
/* Flag telling if the current segment was found to be corrupted */
int currSegmentCorrupted;
/* Counter for corrupted segments per picture */
int nOfCorruptedSegments;
 
/* State variables for error detector and concealer */
int concealment;
 
} ercVariables_t;
 
/*
* External function interface
*/
 
void ercInit(int pic_sizex, int pic_sizey, int flag);
ercVariables_t *ercOpen( void );
void ercReset( ercVariables_t *errorVar, int nOfMBs, int numOfSegments, int picSizeX );
void ercClose( ercVariables_t *errorVar );
void ercSetErrorConcealment( ercVariables_t *errorVar, int value );
 
void ercStartSegment( int currMBNum, int segment, unsigned int bitPos, ercVariables_t *errorVar );
void ercStopSegment( int currMBNum, int segment, unsigned int bitPos, ercVariables_t *errorVar );
void ercMarkCurrSegmentLost(int picSizeX, ercVariables_t *errorVar );
void ercMarkCurrSegmentOK(int picSizeX, ercVariables_t *errorVar );
void ercMarkCurrMBConcealed( int currMBNum, int comp, int picSizeX, ercVariables_t *errorVar );
 
int ercConcealIntraFrame( frame *recfr, int picSizeX, int picSizeY, ercVariables_t *errorVar );
int ercConcealInterFrame( frame *recfr, objectBuffer_t *object_list,
int picSizeX, int picSizeY, ercVariables_t *errorVar, int chroma_format_idc );
 
 
/* Thomson APIs for concealing entire frame loss */
 
#include "mbuffer.h"
#include "output.h"
 
struct concealment_node {
StorablePicture* picture;
int missingpocs;
struct concealment_node *next;
};
 
struct concealment_node * init_node(StorablePicture* , int );
void print_node( struct concealment_node * );
void print_list( struct concealment_node * );
void add_node( struct concealment_node * );
void delete_node( struct concealment_node * );
void init_lists_for_non_reference_loss(int , PictureStructure );
 
void conceal_non_ref_pics(int diff);
void conceal_lost_frames(ImageParameters *img);
 
void sliding_window_poc_management(StorablePicture *p);
 
void write_lost_non_ref_pic(int poc, int p_out);
void write_lost_ref_after_idr(int pos);
 
FrameStore *last_out_fs;
int pocs_in_dpb[100];
int comp(const void *, const void *);
 
 
#endif
 
/win32.h
0,0 → 1,68
 
/*!
************************************************************************
* \file
* win32.h
*
* \brief
* win32 definitions for H.264 encoder.
*
* \author
*
************************************************************************
*/
#ifndef _WIN32_H_
#define _WIN32_H_
 
# include <fcntl.h>
# include <stdio.h>
 
#if defined(WIN32)
# include <io.h>
# include <sys/types.h>
# include <sys/stat.h>
# define strcasecmp strcmpi
 
# define snprintf _snprintf
# define open _open
# define close _close
# define read _read
# define write _write
# define lseek _lseeki64
# define fsync _commit
# define tell _tell
# define TIMEB _timeb
# define ftime _ftime
# define OPENFLAGS_WRITE _O_WRONLY|_O_CREAT|_O_BINARY|_O_TRUNC
# define OPEN_PERMISSIONS _S_IREAD | _S_IWRITE
# define OPENFLAGS_READ _O_RDONLY|_O_BINARY
# define inline _inline
#else
# include <unistd.h>
# define TIMEB timeb
# define OPENFLAGS_WRITE O_WRONLY|O_CREAT|O_TRUNC
# define OPENFLAGS_READ O_RDONLY
# define OPEN_PERMISSIONS S_IRUSR | S_IWUSR
 
# if __STDC_VERSION__ >= 199901L
/* "inline" is a keyword */
# else
# define inline /* nothing */
# endif
#endif
 
#if defined(WIN32) && !defined(__GNUC__)
typedef __int64 int64;
# define FORMAT_OFF_T "I64d"
# ifndef INT64_MIN
# define INT64_MIN (-9223372036854775807i64 - 1i64)
# endif
#else
typedef long long int64;
# define FORMAT_OFF_T "lld"
# ifndef INT64_MIN
# define INT64_MIN (-9223372036854775807LL - 1LL)
# endif
#endif
 
#endif
/elements.h
0,0 → 1,107
 
/*!
*************************************************************************************
* \file elements.h
*
* \brief
* Header file for elements in H.264 streams
*
* \date
* 6.10.2000
*
* \version
* 1.0
*
* \author
* Sebastian Purreiter <sebastian.purreiter@mch.siemens.de> \n
* Siemens AG, Information and Communication Mobile \n
* P.O.Box 80 17 07 \n
* D-81617 Munich, Germany \n
*************************************************************************************
*/
 
#ifndef _ELEMENTS_H_
#define _ELEMENTS_H_
 
/*!
* definition of H.264 syntax elements
* order of elements follow dependencies for picture reconstruction
*/
/*!
* \brief Assignment of old TYPE partition elements to new
* elements
*
* old element | new elements
* ----------------+-------------------------------------------------------------------
* TYPE_HEADER | SE_HEADER, SE_PTYPE
* TYPE_MBHEADER | SE_MBTYPE, SE_REFFRAME, SE_INTRAPREDMODE
* TYPE_MVD | SE_MVD
* TYPE_CBP | SE_CBP_INTRA, SE_CBP_INTER
* SE_DELTA_QUANT_INTER
* SE_DELTA_QUANT_INTRA
* TYPE_COEFF_Y | SE_LUM_DC_INTRA, SE_LUM_AC_INTRA, SE_LUM_DC_INTER, SE_LUM_AC_INTER
* TYPE_2x2DC | SE_CHR_DC_INTRA, SE_CHR_DC_INTER
* TYPE_COEFF_C | SE_CHR_AC_INTRA, SE_CHR_AC_INTER
* TYPE_EOS | SE_EOS
*/
 
#define SE_HEADER 0
#define SE_PTYPE 1
#define SE_MBTYPE 2
#define SE_REFFRAME 3
#define SE_INTRAPREDMODE 4
#define SE_MVD 5
#define SE_CBP_INTRA 6
#define SE_LUM_DC_INTRA 7
#define SE_CHR_DC_INTRA 8
#define SE_LUM_AC_INTRA 9
#define SE_CHR_AC_INTRA 10
#define SE_CBP_INTER 11
#define SE_LUM_DC_INTER 12
#define SE_CHR_DC_INTER 13
#define SE_LUM_AC_INTER 14
#define SE_CHR_AC_INTER 15
#define SE_DELTA_QUANT_INTER 16
#define SE_DELTA_QUANT_INTRA 17
#define SE_BFRAME 18
#define SE_EOS 19
#define SE_MAX_ELEMENTS 20
 
 
#define NO_EC 0 //!< no error concealment necessary
#define EC_REQ 1 //!< error concealment required
#define EC_SYNC 2 //!< search and sync on next header element
 
#define MAXPARTITIONMODES 2 //!< maximum possible partition modes as defined in assignSE2partition[][]
 
/*!
* \brief lookup-table to assign different elements to partition
*
* \note here we defined up to 6 different partitions similar to
* document Q15-k-18 described in the PROGFRAMEMODE.
* The Sliceheader contains the PSYNC information. \par
*
* Elements inside a partition are not ordered. They are
* ordered by occurence in the stream.
* Assumption: Only partitionlosses are considered. \par
*
* The texture elements luminance and chrominance are
* not ordered in the progressive form
* This may be changed in image.c \par
*
* We also defined the proposed internet partition mode
* of Stephan Wenger here. To select the desired mode
* uncomment one of the two following lines. \par
*
* -IMPORTANT:
* Picture- or Sliceheaders must be assigned to partition 0. \par
* Furthermore partitions must follow syntax dependencies as
* outlined in document Q15-J-23.
*/
 
 
extern int assignSE2partition[][SE_MAX_ELEMENTS];
extern int PartitionMode;
 
#endif
 
/defines.h
0,0 → 1,155
 
/*!
**************************************************************************
* \file defines.h
*
* \brief
* Headerfile containing some useful global definitions
*
* \author
* Detlev Marpe
* Copyright (C) 2000 HEINRICH HERTZ INSTITUTE All Rights Reserved.
*
* \date
* 21. March 2001
**************************************************************************
*/
 
#ifndef _DEFINES_H_
#define _DEFINES_H_
 
#if defined _DEBUG
#define TRACE 0 //!< 0:Trace off 1:Trace on 2:detailed CABAC context information
#else
#define TRACE 0 //!< 0:Trace off 1:Trace on 2:detailed CABAC context information
#endif
 
// Dump dbp for debug purposes
#define DUMP_DPB 0
//#define PAIR_FIELDS_IN_OUTPUT
 
//#define MAX_NUM_SLICES 150
#define MAX_NUM_SLICES 50
 
//FREXT Profile IDC definitions
#define FREXT_HP 100 //!< YUV 4:2:0/8 "High"
#define FREXT_Hi10P 110 //!< YUV 4:2:0/10 "High 10"
#define FREXT_Hi422 122 //!< YUV 4:2:2/10 "High 4:2:2"
#define FREXT_Hi444 144 //!< YUV 4:4:4/12 "High 4:4:4"
 
#define YUV400 0
#define YUV420 1
#define YUV422 2
#define YUV444 3
 
 
#define ZEROSNR 0
 
// CAVLC
#define LUMA 0
#define LUMA_INTRA16x16DC 1
#define LUMA_INTRA16x16AC 2
 
#define TOTRUN_NUM 15
#define RUNBEFORE_NUM 7
 
 
//--- block types for CABAC ----
#define LUMA_16DC 0
#define LUMA_16AC 1
#define LUMA_8x8 2
#define LUMA_8x4 3
#define LUMA_4x8 4
#define LUMA_4x4 5
#define CHROMA_DC 6
#define CHROMA_AC 7
#define CHROMA_DC_2x4 8
#define CHROMA_DC_4x4 9
#define NUM_BLOCK_TYPES 10
 
 
#define MAX_CODED_FRAME_SIZE 8000000 //!< bytes for one frame
 
//#define _LEAKYBUCKET_
 
#define P8x8 8
#define I4MB 9
#define I16MB 10
#define IBLOCK 11
#define SI4MB 12
#define I8MB 13
#define IPCM 14
#define MAXMODE 15
 
#define IS_INTRA(MB) ((MB)->mb_type==I4MB || (MB)->mb_type==I16MB ||(MB)->mb_type==IPCM || (MB)->mb_type==I8MB || (MB)->mb_type==SI4MB)
#define IS_NEWINTRA(MB) ((MB)->mb_type==I16MB || (MB)->mb_type==IPCM)
#define IS_OLDINTRA(MB) ((MB)->mb_type==I4MB)
 
#define IS_INTER(MB) ((MB)->mb_type!=I4MB && (MB)->mb_type!=I16MB && (MB)->mb_type!=I8MB && (MB)->mb_type!=IPCM)
#define IS_INTERMV(MB) ((MB)->mb_type!=I4MB && (MB)->mb_type!=I16MB && (MB)->mb_type!=I8MB && (MB)->mb_type!=0 && (MB)->mb_type!=IPCM)
#define IS_DIRECT(MB) ((MB)->mb_type==0 && (img->type==B_SLICE ))
#define IS_COPY(MB) ((MB)->mb_type==0 && (img->type==P_SLICE || img->type==SP_SLICE))
#define IS_P8x8(MB) ((MB)->mb_type==P8x8)
 
 
// Quantization parameter range
 
#define MIN_QP 0
#define MAX_QP 51
 
#define BLOCK_SIZE 4
#define MB_BLOCK_SIZE 16
#define MB_BLOCK_PIXELS 256 // MB_BLOCK_SIZE * MB_BLOCK_SIZE
#define BLOCK_MULTIPLE 4 // (MB_BLOCK_SIZE/BLOCK_SIZE)
 
#define NO_INTRA_PMODE 9 //!< #intra prediction modes
/* 4x4 intra prediction modes */
#define VERT_PRED 0
#define HOR_PRED 1
#define DC_PRED 2
#define DIAG_DOWN_LEFT_PRED 3
#define DIAG_DOWN_RIGHT_PRED 4
#define VERT_RIGHT_PRED 5
#define HOR_DOWN_PRED 6
#define VERT_LEFT_PRED 7
#define HOR_UP_PRED 8
 
// 16x16 intra prediction modes
#define VERT_PRED_16 0
#define HOR_PRED_16 1
#define DC_PRED_16 2
#define PLANE_16 3
 
// 8x8 chroma intra prediction modes
#define DC_PRED_8 0
#define HOR_PRED_8 1
#define VERT_PRED_8 2
#define PLANE_8 3
 
#define EOS 1 //!< End Of Sequence
#define SOP 2 //!< Start Of Picture
#define SOS 3 //!< Start Of Slice
 
#define DECODING_OK 0
#define SEARCH_SYNC 1
#define PICTURE_DECODED 2
 
#define MAX_REFERENCE_PICTURES 32 //!< H264 allows 32 fields
 
#define INVALIDINDEX (-135792468)
 
#define MVPRED_MEDIAN 0
#define MVPRED_L 1
#define MVPRED_U 2
#define MVPRED_UR 3
 
#define DECODE_COPY_MB 0
#define DECODE_MB 1
//#define DECODE_MB_BFRAME 2
 
 
//Start code and Emulation Prevention need this to be defined in identical manner at encoder and decoder
#define ZEROBYTES_SHORTSTARTCODE 2 //indicates the number of zero bytes in the short start-code prefix
 
#endif
 
/mb_access.h
0,0 → 1,36
 
/*!
*************************************************************************************
* \file mb_access.h
*
* \brief
* Functions for macroblock neighborhoods
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
 
*************************************************************************************
*/
 
#ifndef _MB_ACCESS_H_
#define _MB_ACCESS_H_
 
void CheckAvailabilityOfNeighbors(void);
 
//void getNeighbour(int curr_mb_nr, int xN, int yN, int luma, PixelPos *pix);
void (*getNeighbour)(unsigned int curr_mb_nr, int xN, int yN, int is_chroma, PixelPos *pix);
void getAffNeighbour(unsigned int curr_mb_nr, int xN, int yN, int is_chroma, PixelPos *pix);
void getNonAffNeighbour(unsigned int curr_mb_nr, int xN, int yN, int is_chroma, PixelPos *pix);
 
void getLuma4x4Neighbour (int curr_mb_nr, int block_x, int block_y, PixelPos *pix);
void getChroma4x4Neighbour (int curr_mb_nr, int block_x, int block_y, PixelPos *pix);
 
int mb_is_available(int mbAddr, int currMbAddr);
void get_mb_pos (int mb_addr, int *x, int*y, int is_chroma);
void (*get_mb_block_pos) (int mb_addr, int *x, int*y);
void get_mb_block_pos_normal (int mb_addr, int *x, int*y);
void get_mb_block_pos_mbaff (int mb_addr, int *x, int*y);
 
 
 
#endif
/loopfilter.h
0,0 → 1,18
/*!
************************************************************************
* \file
* loopfilter.h
* \brief
* external loop filter interface
************************************************************************
*/
 
#ifndef _LOOPFILTER_H_
#define _LOOPFILTER_H_
 
#include "global.h"
#include "mbuffer.h"
 
void DeblockPicture(struct img_par *img, StorablePicture *p) ;
 
#endif //_LOOPFILTER_H_
/ifunctions.h
0,0 → 1,144
 
/*!
************************************************************************
* \file
* ifunctions.h
*
* \brief
* define some inline functions that are used within the encoder.
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
 
* - Alexis Tourapis <alexismt@ieee.org>
*
************************************************************************
*/
 
#ifndef _IFUNCTIONS_H_
#define _IFUNCTIONS_H_
 
# if defined(WIN32) || (__STDC_VERSION__ >= 199901L)
static inline int imin(int a, int b)
{
return ((a) < (b)) ? (a) : (b);
}
 
static inline int imax(int a, int b)
{
return ((a) > (b)) ? (a) : (b);
}
 
static inline double dmin(double a, double b)
{
return ((a) < (b)) ? (a) : (b);
}
 
static inline double dmax(double a, double b)
{
return ((a) > (b)) ? (a) : (b);
}
 
static inline int64 i64min(int64 a, int64 b)
{
return ((a) < (b)) ? (a) : (b);
}
 
static inline int64 i64max(int64 a, int64 b)
{
return ((a) > (b)) ? (a) : (b);
}
 
static inline int iabs(int x)
{
return ((x) < 0) ? -(x) : (x);
}
 
static inline double dabs(double x)
{
return ((x) < 0) ? -(x) : (x);
}
 
static inline int isign(int x)
{
return ((x) < 0) ? -1 : 1;
}
 
static inline int isignab(int a, int b)
{
return ((b) < 0) ? -iabs(a) : iabs(a);
}
 
static inline int rshift_rnd(int x, int a)
{
return (a > 0) ? ((x + (1 << (a-1) )) >> a) : (x << (-a));
}
 
static inline unsigned int rshift_rnd_us(unsigned int x, unsigned int a)
{
return (a > 0) ? ((x + (1 << (a-1))) >> a) : x;
}
 
static inline int rshift_rnd_sf(int x, int a)
{
return ((x + (1 << (a-1) )) >> a);
}
 
static inline unsigned int rshift_rnd_us_sf(unsigned int x, unsigned int a)
{
return ((x + (1 << (a-1))) >> a);
}
 
static inline int iClip1(int high, int x)
{
x = imax(x, 0);
x = imin(x, high);
 
return x;
}
 
static inline int iClip3(int low, int high, int x)
{
x = imax(x, low);
x = imin(x, high);
 
return x;
}
 
static inline double dClip3(double low, double high, double x)
{
x = dmax(x, low);
x = dmin(x, high);
 
return x;
}
 
static inline int RSD(int x)
{
return ((x&2)?(x|1):(x&(~1)));
}
 
# else
 
# define imin(a, b) (((a) < (b)) ? (a) : (b))
# define imax(a, b) (((a) > (b)) ? (a) : (b))
# define dmin(a, b) (((a) < (b)) ? (a) : (b))
# define dmax(a, b) (((a) > (b)) ? (a) : (b))
# define i64min(a, b) (((a) < (b)) ? (a) : (b))
# define i64max(a, b) (((a) > (b)) ? (a) : (b))
# define iabs(x) (((x) < 0) ? -(x) : (x))
# define dabs(x) (((x) < 0) ? -(x) : (x))
# define isign(x) (((x) < 0) ? -1 : 1)
# define isignab(a, b) (((b) < 0) ? -iabs(a) : iabs(a))
# define rshift_rnd(x, a) (((a) > 0) ? (((x) + (1 << ((a)-1))) >> (a)) : ((x) << (-(a)))
# define rshift_rnd_us(x, a) (((a) > 0) ? (((x) + (1 << ((a)-1))) >> (a)) : (x))
# define rshift_rnd_sf(x, a) (((x) + (1 << ((a)-1))) >> (a))
# define rshift_rnd_us_sf(x, a) (((x) + (1 << ((a)-1))) >> (a))
# define iClip1(high, x) (imax( imin(x, high), 0))
# define iClip3(low, high, x) (imax( imin(x, high), low))
# define dClip3(low, high, x) (dmax( dmin(x, high), low))
# define RSD(x) (((x)&2)?((x)|1):((x)&(~1)))
 
# endif
#endif
 
/image.h
0,0 → 1,24
 
/*!
************************************************************************
* \file image.h
*
* \brief
* prototypes for image.c
*
************************************************************************
*/
 
#ifndef _IMAGE_H_
#define _IMAGE_H_
 
#include "mbuffer.h"
 
extern StorablePicture *dec_picture;
 
void find_snr(struct snr_par *snr, StorablePicture *p, int p_ref);
void get_block(int ref_frame, StorablePicture **list, int x_pos, int y_pos, struct img_par *img, int block[BLOCK_SIZE][BLOCK_SIZE]);
int picture_order(struct img_par *img);
 
#endif
 
/transform8x8.h
0,0 → 1,38
/*!
***************************************************************************
*
* \file transform8x8.h
*
* \brief
* prototypes of 8x8 transform functions
*
* \date
* 9. October 2003
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Yuri Vatis vatis@hhi.de
**************************************************************************/
 
#ifndef _TRANSFORM8X8_H_
#define _TRANSFORM8X8_H_
 
#include "global.h"
#include "image.h"
#include "mb_access.h"
#include "elements.h"
#include <math.h>
 
 
int **cofAC8x8_intra, ****cofAC8x8_iintra; // [level/run][scan_pos]
 
 
void intrapred_luma8x8(int img_x,int img_y, int *left_available, int *up_available, int *all_available);
int intrapred8x8(struct img_par *img, int b8);
void itrans8x8(struct img_par *img, int ioff, int joff);
double RDCost_for_8x8IntraBlocks(int *c_nz, int b8, int ipmode, double lambda, double min_rdcost, int mostProbableMode);
int dct_luma8x8(int block_x,int block_y,int *coeff_cost);
void LowPassForIntra8x8Pred(imgpel *PredPel, int block_up_left, int block_up, int block_left);
 
 
#endif
/vlc.h
0,0 → 1,56
 
/*!
************************************************************************
* \file vlc.h
*
* \brief
* header for (CA)VLC coding functions
*
* \author
* Karsten Suehring
*
************************************************************************
*/
 
#ifndef _VLC_H_
#define _VLC_H_
 
int se_v (char *tracestring, Bitstream *bitstream);
int ue_v (char *tracestring, Bitstream *bitstream);
Boolean u_1 (char *tracestring, Bitstream *bitstream);
int u_v (int LenInBits, char *tracestring, Bitstream *bitstream);
 
// UVLC mapping
void linfo_ue(int len, int info, int *value1, int *dummy);
void linfo_se(int len, int info, int *value1, int *dummy);
 
void linfo_cbp_intra(int len,int info,int *cbp, int *dummy);
void linfo_cbp_inter(int len,int info,int *cbp, int *dummy);
void linfo_levrun_inter(int len,int info,int *level,int *irun);
void linfo_levrun_c2x2(int len,int info,int *level,int *irun);
 
int readSyntaxElement_VLC (SyntaxElement *sym, Bitstream *currStream);
int readSyntaxElement_UVLC(SyntaxElement *sym, struct img_par *img, struct datapartition *dp);
int readSyntaxElement_Intra4x4PredictionMode(SyntaxElement *sym, struct img_par *img, struct datapartition *dp);
 
int GetVLCSymbol (byte buffer[],int totbitoffset,int *info, int bytecount);
int GetVLCSymbol_IntraMode (byte buffer[],int totbitoffset,int *info, int bytecount);
 
int readSyntaxElement_FLC(SyntaxElement *sym, Bitstream *currStream);
int readSyntaxElement_NumCoeffTrailingOnes(SyntaxElement *sym, DataPartition *dP,
char *type);
int readSyntaxElement_NumCoeffTrailingOnesChromaDC(SyntaxElement *sym, DataPartition *dP);
int readSyntaxElement_Level_VLC0(SyntaxElement *sym, struct datapartition *dP);
int readSyntaxElement_Level_VLCN(SyntaxElement *sym, int vlc, struct datapartition *dP);
int readSyntaxElement_TotalZeros(SyntaxElement *sym, DataPartition *dP);
int readSyntaxElement_TotalZerosChromaDC(SyntaxElement *sym, DataPartition *dP);
int readSyntaxElement_Run(SyntaxElement *sym, DataPartition *dP);
int GetBits (byte buffer[],int totbitoffset,int *info, int bytecount,
int numbits);
int ShowBits (byte buffer[],int totbitoffset,int bytecount, int numbits);
 
int more_rbsp_data (byte buffer[],int totbitoffset,int bytecount);
 
 
#endif
 
/biaridecod.h
0,0 → 1,39
 
/*!
***************************************************************************
* \file
* biaridecod.h
*
* \brief
* Headerfile for binary arithmetic decoder routines
*
* \author
* Detlev Marpe,
 
* Copyright (C) 2000 HEINRICH HERTZ INSTITUTE All Rights Reserved.
*
* \date
* 21. Oct 2000
**************************************************************************
*/
 
#ifndef _BIARIDECOD_H_
#define _BIARIDECOD_H_
 
 
/************************************************************************
* D e f i n i t i o n s
***********************************************************************
*/
 
void arideco_start_decoding(DecodingEnvironmentPtr eep, unsigned char *code_buffer, int firstbyte, int *code_len, int slice_type);
int arideco_bits_read(DecodingEnvironmentPtr dep);
void arideco_done_decoding(DecodingEnvironmentPtr dep);
void biari_init_context (struct img_par *img, BiContextTypePtr ctx, const int* ini);
void rescale_cum_freq(BiContextTypePtr bi_ct);
unsigned int biari_decode_symbol(DecodingEnvironmentPtr dep, BiContextTypePtr bi_ct );
unsigned int biari_decode_symbol_eq_prob(DecodingEnvironmentPtr dep);
unsigned int biari_decode_final(DecodingEnvironmentPtr dep);
 
#endif // BIARIDECOD_H_
 
/mbuffer.h
0,0 → 1,223
 
/*!
***********************************************************************
* \file
* mbuffer.h
*
* \brief
* Frame buffer functions
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
 
* - Jill Boyce <jill.boyce@thomson.net>
* - Saurav K Bandyopadhyay <saurav@ieee.org>
* - Zhenyu Wu <Zhenyu.Wu@thomson.net
* - Purvin Pandit <Purvin.Pandit@thomson.net>
*
***********************************************************************
*/
#ifndef _MBUFFER_H_
#define _MBUFFER_H_
 
#include "global.h"
 
#define MAX_LIST_SIZE 33
 
//! definition a picture (field or frame)
typedef struct storable_picture
{
PictureStructure structure;
 
int poc;
int top_poc;
int bottom_poc;
int frame_poc;
int64 ref_pic_num [MAX_NUM_SLICES][6][MAX_LIST_SIZE];
int64 frm_ref_pic_num [MAX_NUM_SLICES][6][MAX_LIST_SIZE];
int64 top_ref_pic_num [MAX_NUM_SLICES][6][MAX_LIST_SIZE];
int64 bottom_ref_pic_num [MAX_NUM_SLICES][6][MAX_LIST_SIZE];
unsigned frame_num;
unsigned recovery_frame;
 
int pic_num;
int long_term_pic_num;
int long_term_frame_idx;
 
int is_long_term;
int used_for_reference;
int is_output;
int non_existing;
 
short max_slice_id;
 
int size_x, size_y, size_x_cr, size_y_cr;
int size_x_m1, size_y_m1, size_x_cr_m1, size_y_cr_m1;
int chroma_vector_adjustment;
int coded_frame;
int MbaffFrameFlag;
unsigned PicWidthInMbs;
unsigned PicSizeInMbs;
 
imgpel ** imgY; //!< Y picture component
imgpel *** imgUV; //!< U and V picture components
 
byte * mb_field; //!< field macroblock indicator
 
short ** slice_id; //!< reference picture [mb_x][mb_y]
 
char *** ref_idx; //!< reference picture [list][subblock_y][subblock_x]
 
int64 *** ref_pic_id; //!< reference picture identifier [list][subblock_y][subblock_x]
// (not simply index)
 
int64 *** ref_id; //!< reference picture identifier [list][subblock_y][subblock_x]
// (not simply index)
 
short **** mv; //!< motion vector [list][subblock_y][subblock_x][component]
 
byte ** moving_block;
byte ** field_frame; //!< indicates if co_located is field or frame.
 
struct storable_picture *top_field; // for mb aff, if frame for referencing the top field
struct storable_picture *bottom_field; // for mb aff, if frame for referencing the bottom field
struct storable_picture *frame; // for mb aff, if field for referencing the combined frame
 
int slice_type;
int idr_flag;
int no_output_of_prior_pics_flag;
int long_term_reference_flag;
int adaptive_ref_pic_buffering_flag;
 
int chroma_format_idc;
int frame_mbs_only_flag;
int frame_cropping_flag;
int frame_cropping_rect_left_offset;
int frame_cropping_rect_right_offset;
int frame_cropping_rect_top_offset;
int frame_cropping_rect_bottom_offset;
int qp;
int chroma_qp_offset[2];
int slice_qp_delta;
DecRefPicMarking_t *dec_ref_pic_marking_buffer; //!< stores the memory management control operations
 
// picture error concealment
int concealed_pic; //indicates if this is a concealed picutre
 
} StorablePicture;
 
 
//! definition a picture (field or frame)
typedef struct colocated_params
{
int mb_adaptive_frame_field_flag;
int size_x, size_y;
 
int64 ref_pic_num[6][MAX_LIST_SIZE];
 
char *** ref_idx; //!< reference picture [list][subblock_y][subblock_x]
int64 *** ref_pic_id; //!< reference picture identifier [list][subblock_y][subblock_x]
short **** mv; //!< motion vector [list][subblock_y][subblock_x][component]
byte ** moving_block;
 
// Top field params
int64 top_ref_pic_num[6][MAX_LIST_SIZE];
char *** top_ref_idx; //!< reference picture [list][subblock_y][subblock_x]
int64 *** top_ref_pic_id; //!< reference picture identifier [list][subblock_y][subblock_x]
short **** top_mv; //!< motion vector [list][subblock_y][subblock_x][component]
byte ** top_moving_block;
 
// Bottom field params
int64 bottom_ref_pic_num[6][MAX_LIST_SIZE];
char *** bottom_ref_idx; //!< reference picture [list][subblock_y][subblock_x]
int64 *** bottom_ref_pic_id; //!< reference picture identifier [list][subblock_y][subblock_x]
short **** bottom_mv; //!< motion vector [list][subblock_y][subblock_x][component]
byte ** bottom_moving_block;
 
byte is_long_term;
byte ** field_frame; //!< indicates if co_located is field or frame.
 
} ColocatedParams;
 
//! Frame Stores for Decoded Picture Buffer
typedef struct frame_store
{
int is_used; //!< 0=empty; 1=top; 2=bottom; 3=both fields (or frame)
int is_reference; //!< 0=not used for ref; 1=top used; 2=bottom used; 3=both fields (or frame) used
int is_long_term; //!< 0=not used for ref; 1=top used; 2=bottom used; 3=both fields (or frame) used
int is_orig_reference; //!< original marking by nal_ref_idc: 0=not used for ref; 1=top used; 2=bottom used; 3=both fields (or frame) used
 
int is_non_existent;
 
unsigned frame_num;
unsigned recovery_frame;
 
int frame_num_wrap;
int long_term_frame_idx;
int is_output;
int poc;
 
// picture error concealment
int concealment_reference;
 
StorablePicture *frame;
StorablePicture *top_field;
StorablePicture *bottom_field;
 
} FrameStore;
 
 
//! Decoded Picture Buffer
typedef struct decoded_picture_buffer
{
FrameStore **fs;
FrameStore **fs_ref;
FrameStore **fs_ltref;
unsigned size;
unsigned used_size;
unsigned ref_frames_in_buffer;
unsigned ltref_frames_in_buffer;
int last_output_poc;
int max_long_term_pic_idx;
 
int init_done;
int num_ref_frames;
 
FrameStore *last_picture;
} DecodedPictureBuffer;
 
 
extern DecodedPictureBuffer dpb;
extern StorablePicture **listX[6];
extern int listXsize[6];
 
void init_dpb(void);
void free_dpb(void);
FrameStore* alloc_frame_store(void);
void free_frame_store(FrameStore* f);
StorablePicture* alloc_storable_picture(PictureStructure type, int size_x, int size_y, int size_x_cr, int size_y_cr);
void free_storable_picture(StorablePicture* p);
void store_picture_in_dpb(StorablePicture* p);
void flush_dpb(void);
 
void dpb_split_field(FrameStore *fs);
void dpb_combine_field(FrameStore *fs);
void dpb_combine_field_yuv(FrameStore *fs);
 
void init_lists(int currSliceType, PictureStructure currPicStructure);
void reorder_ref_pic_list(StorablePicture **list, int *list_size,
int num_ref_idx_lX_active_minus1, int *reordering_of_pic_nums_idc,
int *abs_diff_pic_num_minus1, int *long_term_pic_idx);
 
void init_mbaff_lists();
void alloc_ref_pic_list_reordering_buffer(Slice *currSlice);
void free_ref_pic_list_reordering_buffer(Slice *currSlice);
 
void fill_frame_num_gap(ImageParameters *img);
 
ColocatedParams* alloc_colocated(int size_x, int size_y,int mb_adaptive_frame_field_flag);
void free_colocated(ColocatedParams* p);
void compute_colocated(ColocatedParams* p, StorablePicture **listX[6]);
 
#endif
 
/contributors.h
0,0 → 1,208
 
/*! \file
* contributors.h
* \brief
* List of contributors and copyright information.
*
* \par Copyright statements
\verbatim
H.264 JM coder/decoder
 
Copyright (C) 2000 by
Telenor Satellite Services, Norway
Ericsson Radio Systems, Sweden
TELES AG, Germany
Nokia Inc., USA
Nokia Corporation, Finland
Siemens AG, Germany
Heinrich-Hertz-Institute for Communication Technology GmbH, Germany
University of Hannover, Institut of Communication Theory and Signal Processing,Germany
TICSP, Tampere University of Technology, Finland
Munich University of Technology, Institute for Communications Engineering, Germany
Videolocus, Canada
Motorola Inc., USA
Microsoft Corp., USA
Apple Computer, Inc.
RealNetworks, Inc., USA
Thomson, Inc., USA
\endverbatim
\par Full Contact Information
\verbatim
 
Lowell Winger <lwinger@videolocus.com><lwinger@uwaterloo.ca>
 
Michael Gallant <mgallant@videolocus.com>
VideoLocus Inc.
97 Randall Dr.
Waterloo, ON, Canada N2V1C5
 
 
Telenor Satellite Services
P.O.Box 6914 St.Olavs plass
N-0130 Oslo, Norway
 
Rickard Sjoberg <rickard.sjoberg@era.ericsson.se>
Ericsson Radio Systems
KI/ERA/T/VV
164 80 Stockholm, Sweden
 
Stephan Wenger <stewe@cs.tu-berlin.de>
TU Berlin / TELES AG
Sekr. FR 6-3
Franklinstr. 28-29
D-10587 Berlin, Germany
 
Jani Lainema <jani.lainema@nokia.com>
Nokia Inc. / Nokia Research Center
6000 Connection Drive
Irving, TX 75039, USA
 
Sebastian Purreiter <sebastian.purreiter@mch.siemens.de>
Siemens AG
ICM MD MP RD MCH 83
P.O.Box 80 17 07
D-81617 Munich, Germany
 
Thomas Wedi <wedi@tnt.uni-hannover.de>
University of Hannover
Institut of Communication Theory and Signal Processing
Appelstr. 9a
30167 Hannover, Germany
 
Guido Heising <heising@hhi.de>
Heinrich-Hertz-Institute
Einsteinufer 37
10587 Berlin
Germany
 
Gabi Blaettermann <blaetter@hhi.de>
Heinrich-Hertz-Institute
Einsteinufer 37
10587 Berlin
Germany
 
Detlev Marpe <marpe@hhi.de>
Heinrich-Hertz-Institute
Einsteinufer 37
10587 Berlin
Germany
 
Ragip Kurceren <ragip.kurceren@nokia.com>
Nokia Inc. / Nokia Research Center
6000 Connection Drive
Irving, TX 75039, USA
 
Viktor Varsa <viktor.varsa@nokia.com>
Nokia Inc. / Nokia Research Center
6000 Connection Drive
Irving, TX 75039, USA
 
Ye-Kui Wang <wyk@ieee.org>
Tampere University of Technology
Tampere International Center for Signal Processing
33720 Tampere, Finland
 
Ari Hourunranta <ari.hourunranta@nokia.com>
Nokia Corporation / Nokia Mobile Phones
P.O. Box 88
33721 Tampere, Finland
 
Yann Le Maguet <yann.lemaguet@philips.com>
Philips Research France
 
Dong Tian <tian@cs.tut.fi>
Tampere University of Technology
Tampere International Center for Signal Processing
33720 Tampere, Finland
 
Miska M. Hannuksela <miska.hannuksela@nokia.com>
Nokia Corporation / Nokia Mobile Phones
P.O. Box 88
33721 Tampere, Finland
 
Karsten Suehring <suehring@hhi.de>
Heinrich-Hertz-Institute
Einsteinufer 37
10587 Berlin
Germany
 
Heiko Schwarz <hschwarz@hhi.de>
Heinrich-Hertz-Institute
Einsteinufer 37
10587 Berlin
Germany
 
Tobias Oelbaum <drehvial@gmx.net>
Institute for Communications Engineering
Munich University of Technology
Germany
 
Limin Wang <liwang@gi.com>
Krit Panusopone <kpanusopone@gi.com>
Rajeev Gandhi <rgandhi@gi.com>
Yue Yu <yyu@gi.com>
Motorola Inc.
6450 Sequence Drive
San Diego, CA 92121 USA
 
Feng Wu <fengwu@microsoft.com>
Xiaoyan Sun <sunxiaoyan@msrchina.research.microsoft.com>
Microsoft Research Asia
3/F, Beijing Sigma Center
No.49, Zhichun Road, Hai Dian District,
Beijing China 100080
 
Yoshihiro Kikuchi <yoshihiro.kikuchi@toshiba.co.jp>
Takeshi Chujoh <takeshi.chujoh@toshiba.co.jp>
Toshiba Corporation
Research and Development Center
Kawasaki 212-8582, Japan
 
Shinya Kadono <kadono@drl.mei.co.jp>
Matsushita Electric Industrial Co., Ltd.
1006 Kadoma, Kadoma
Osaka 663-8113, Japan
 
Dzung Hoang <dthoang@yahoo.com>
10533 Roy Butler Dr.
Austin, TX 78717
 
Eric Viscito <eric@ev-consulting.com>
eV Consulting
52 Tracy Ln
Shelburne, VT 05482 USA
 
Barry Haskell
Apple Computer, Inc. <bhaskell@apple.com>
2 Infinite Loop
Cupertino, California 95014
 
Greg Conklin
RealNetworks, Inc. <gregc@real.com>
2601 Elliott Ave
Seattle, WA 98101
 
Jill Boyce <jill.boyce@thomson.net>
Cristina Gomila <cristina.gomila@thomson.net>
Thomson
2 Independence Way
Princeton, NJ 08540
 
Alexis Michael Tourapis <alexismt@ieee.org><atour@dolby.com>
Athanasios Leontaris <aleon@dolby.com>
Dolby Laboratories Inc.
3601 West Alameda Ave.
Burbank, CA 91505
 
Saurav K Bandyopadhyay <saurav@ieee.org>
Purvin Pandit <Purvin.Pandit@thomson.net>
Zhenyu Wu <Zhenyu.Wu@thomson.net>
Thomson Inc.
2 Independence Way
Princeton, NJ 08540
 
 
 
\endverbatim
*/
 
/global.h
0,0 → 1,804
 
/*!
************************************************************************
* \file
* global.h
* \brief
* global definitions for H.264 decoder.
* \author
* Copyright (C) 1999 Telenor Satellite Services,Norway
* Ericsson Radio Systems, Sweden
*
* Inge Lille-Langoy <inge.lille-langoy@telenor.com>
*
* Telenor Satellite Services
* Keysers gt.13 tel.: +47 23 13 86 98
* N-0130 Oslo,Norway fax.: +47 22 77 79 80
*
* Rickard Sjoberg <rickard.sjoberg@era.ericsson.se>
*
* Ericsson Radio Systems
* KI/ERA/T/VV
* 164 80 Stockholm, Sweden
*
************************************************************************
*/
#ifndef _GLOBAL_H_
#define _GLOBAL_H_
 
#include <stdio.h>
#include <stdarg.h>
 
#include <time.h>
#include <sys/timeb.h>
#include "win32.h"
#include "defines.h"
#include "ifunctions.h"
#include "parsetcommon.h"
 
 
typedef unsigned char byte; //!< 8 bit unsigned
typedef unsigned short imgpel; //!< Pixel type definition (16 bit for FRExt)
//typedef unsigned char imgpel; //!< Pixel type definition (8 bit without FRExt)
 
pic_parameter_set_rbsp_t *active_pps;
seq_parameter_set_rbsp_t *active_sps;
 
// global picture format dependent buffers, memory allocation in decod.c
imgpel **imgY_ref; //!< reference frame find snr
imgpel ***imgUV_ref;
 
int **PicPos;
int ReMapRef[20];
// B pictures
int Bframe_ctr;
int frame_no;
 
int g_nFrame;
 
// For MB level frame/field coding
int TopFieldForSkip_Y[16][16];
int TopFieldForSkip_UV[2][16][16];
 
int InvLevelScale4x4Luma_Intra[6][4][4];
int InvLevelScale4x4Chroma_Intra[2][6][4][4];
 
int InvLevelScale4x4Luma_Inter[6][4][4];
int InvLevelScale4x4Chroma_Inter[2][6][4][4];
 
int InvLevelScale8x8Luma_Intra[6][8][8];
 
int InvLevelScale8x8Luma_Inter[6][8][8];
 
int *qmatrix[8];
 
#define ET_SIZE 300 //!< size of error text buffer
char errortext[ET_SIZE]; //!< buffer for error message for exit with error()
 
/***********************************************************************
* T y p e d e f i n i t i o n s f o r T M L
***********************************************************************
*/
 
//! Data Partitioning Modes
typedef enum
{
PAR_DP_1, //!< no data partitioning is supported
PAR_DP_3, //!< data partitioning with 3 partitions
} PAR_DP_TYPE;
 
 
//! Output File Types
typedef enum
{
PAR_OF_ANNEXB, //!< Current TML description
PAR_OF_RTP //!< RTP Packet Output format
} PAR_OF_TYPE;
 
 
//! definition of H.264 syntax elements
typedef enum {
SE_HEADER,
SE_PTYPE,
SE_MBTYPE,
SE_REFFRAME,
SE_INTRAPREDMODE,
SE_MVD,
SE_CBP_INTRA,
SE_LUM_DC_INTRA,
SE_CHR_DC_INTRA,
SE_LUM_AC_INTRA,
SE_CHR_AC_INTRA,
SE_CBP_INTER,
SE_LUM_DC_INTER,
SE_CHR_DC_INTER,
SE_LUM_AC_INTER,
SE_CHR_AC_INTER,
SE_DELTA_QUANT_INTER,
SE_DELTA_QUANT_INTRA,
SE_BFRAME,
SE_EOS,
SE_MAX_ELEMENTS //!< number of maximum syntax elements, this MUST be the last one!
} SE_type; // substituting the definitions in element.h
 
 
typedef enum {
INTER_MB,
INTRA_MB_4x4,
INTRA_MB_16x16
} IntraInterDecision;
 
typedef enum {
BITS_TOTAL_MB,
BITS_HEADER_MB,
BITS_INTER_MB,
BITS_CBP_MB,
BITS_COEFF_Y_MB,
BITS_COEFF_UV_MB,
MAX_BITCOUNTER_MB
} BitCountType;
 
typedef enum {
NO_SLICES,
FIXED_MB,
FIXED_RATE,
CALLBACK,
FMO
} SliceMode;
 
 
typedef enum {
UVLC,
CABAC
} SymbolMode;
 
typedef enum {
LIST_0=0,
LIST_1=1
} Lists;
 
 
typedef enum {
FRAME,
TOP_FIELD,
BOTTOM_FIELD
} PictureStructure; //!< New enum for field processing
 
 
typedef enum {
P_SLICE = 0,
B_SLICE,
I_SLICE,
SP_SLICE,
SI_SLICE
} SliceType;
 
typedef enum
{
IS_LUMA = 0,
IS_CHROMA = 1
} Component_Type;
 
 
/***********************************************************************
* D a t a t y p e s f o r C A B A C
***********************************************************************
*/
 
//! struct to characterize the state of the arithmetic coding engine
typedef struct
{
unsigned int Dlow, Drange;
unsigned int Dvalue;
unsigned int Dbuffer;
int Dbits_to_go;
byte *Dcodestrm;
int *Dcodestrm_len;
} DecodingEnvironment;
 
typedef DecodingEnvironment *DecodingEnvironmentPtr;
 
//! struct for context management
typedef struct
{
unsigned short state; // index into state-table CP
unsigned char MPS; // Least Probable Symbol 0/1 CP
} BiContextType;
 
typedef BiContextType *BiContextTypePtr;
 
 
/**********************************************************************
* C O N T E X T S F O R T M L S Y N T A X E L E M E N T S
**********************************************************************
*/
 
#define NUM_MB_TYPE_CTX 11
#define NUM_B8_TYPE_CTX 9
#define NUM_MV_RES_CTX 10
#define NUM_REF_NO_CTX 6
#define NUM_DELTA_QP_CTX 4
#define NUM_MB_AFF_CTX 4
#define NUM_TRANSFORM_SIZE_CTX 3
 
 
typedef struct
{
BiContextType mb_type_contexts [4][NUM_MB_TYPE_CTX];
BiContextType b8_type_contexts [2][NUM_B8_TYPE_CTX];
BiContextType mv_res_contexts [2][NUM_MV_RES_CTX];
BiContextType ref_no_contexts [2][NUM_REF_NO_CTX];
BiContextType delta_qp_contexts[NUM_DELTA_QP_CTX];
BiContextType mb_aff_contexts [NUM_MB_AFF_CTX];
BiContextType transform_size_contexts [NUM_TRANSFORM_SIZE_CTX];
 
} MotionInfoContexts;
 
#define NUM_IPR_CTX 2
#define NUM_CIPR_CTX 4
#define NUM_CBP_CTX 4
#define NUM_BCBP_CTX 4
#define NUM_MAP_CTX 15
#define NUM_LAST_CTX 15
#define NUM_ONE_CTX 5
#define NUM_ABS_CTX 5
 
 
typedef struct
{
BiContextType ipr_contexts [NUM_IPR_CTX];
BiContextType cipr_contexts[NUM_CIPR_CTX];
BiContextType cbp_contexts [3][NUM_CBP_CTX];
BiContextType bcbp_contexts[NUM_BLOCK_TYPES][NUM_BCBP_CTX];
BiContextType map_contexts [NUM_BLOCK_TYPES][NUM_MAP_CTX];
BiContextType last_contexts[NUM_BLOCK_TYPES][NUM_LAST_CTX];
BiContextType one_contexts [NUM_BLOCK_TYPES][NUM_ONE_CTX];
BiContextType abs_contexts [NUM_BLOCK_TYPES][NUM_ABS_CTX];
BiContextType fld_map_contexts [NUM_BLOCK_TYPES][NUM_MAP_CTX];
BiContextType fld_last_contexts[NUM_BLOCK_TYPES][NUM_LAST_CTX];
} TextureInfoContexts;
 
 
//*********************** end of data type definition for CABAC *******************
 
/***********************************************************************
* N e w D a t a t y p e s f o r T M L
***********************************************************************
*/
 
struct img_par;
struct inp_par;
struct stat_par;
 
/*! Buffer structure for decoded referenc picture marking commands */
typedef struct DecRefPicMarking_s
{
int memory_management_control_operation;
int difference_of_pic_nums_minus1;
int long_term_pic_num;
int long_term_frame_idx;
int max_long_term_frame_idx_plus1;
struct DecRefPicMarking_s *Next;
} DecRefPicMarking_t;
 
//! Syntaxelement
typedef struct syntaxelement
{
int type; //!< type of syntax element for data part.
int value1; //!< numerical value of syntax element
int value2; //!< for blocked symbols, e.g. run/level
int len; //!< length of code
int inf; //!< info part of UVLC code
unsigned int bitpattern; //!< UVLC bitpattern
int context; //!< CABAC context
int k; //!< CABAC context for coeff_count,uv
 
#if TRACE
#define TRACESTRING_SIZE 100 //!< size of trace string
char tracestring[TRACESTRING_SIZE]; //!< trace string
#endif
 
//! for mapping of UVLC to syntaxElement
void (*mapping)(int len, int info, int *value1, int *value2);
//! used for CABAC: refers to actual coding method of each individual syntax element type
void (*reading)(struct syntaxelement *, struct img_par *, DecodingEnvironmentPtr);
 
} SyntaxElement;
 
//! Macroblock
typedef struct macroblock
{
int qp; //!< QP luma
int qpc[2]; //!< QP chroma
 
int slice_nr;
int delta_quant; //!< for rate control
 
struct macroblock *mb_available_up; //!< pointer to neighboring MB (CABAC)
struct macroblock *mb_available_left; //!< pointer to neighboring MB (CABAC)
 
// some storage of macroblock syntax elements for global access
int mb_type;
int mvd[2][BLOCK_MULTIPLE][BLOCK_MULTIPLE][2]; //!< indices correspond to [forw,backw][block_y][block_x][x,y]
int cbp;
int64 cbp_blk ;
int64 cbp_bits;
 
int is_skip;
 
int i16mode;
char b8mode[4];
char b8pdir[4];
int ei_flag;
 
int LFDisableIdc;
int LFAlphaC0Offset;
int LFBetaOffset;
 
int c_ipred_mode; //!< chroma intra prediction mode
int mb_field;
 
int skip_flag;
 
int mbAddrA, mbAddrB, mbAddrC, mbAddrD;
int mbAvailA, mbAvailB, mbAvailC, mbAvailD;
 
int luma_transform_size_8x8_flag;
int NoMbPartLessThan8x8Flag;
} Macroblock;
 
//! Bitstream
typedef struct
{
// CABAC Decoding
int read_len; //!< actual position in the codebuffer, CABAC only
int code_len; //!< overall codebuffer length, CABAC only
// UVLC Decoding
int frame_bitoffset; //!< actual position in the codebuffer, bit-oriented, UVLC only
int bitstream_length; //!< over codebuffer lnegth, byte oriented, UVLC only
// ErrorConcealment
byte *streamBuffer; //!< actual codebuffer for read bytes
int ei_flag; //!< error indication, 0: no error, else unspecified error
} Bitstream;
 
//! DataPartition
typedef struct datapartition
{
 
Bitstream *bitstream;
DecodingEnvironment de_cabac;
 
int (*readSyntaxElement)(SyntaxElement *, struct img_par *, struct datapartition *);
/*!< virtual function;
actual method depends on chosen data partition and
entropy coding method */
} DataPartition;
 
//! Slice
typedef struct
{
int ei_flag; //!< 0 if the partArr[0] contains valid information
int qp;
int slice_qp_delta;
int picture_type; //!< picture type
PictureStructure structure; //!< Identify picture structure type
int start_mb_nr; //!< MUST be set by NAL even in case of ei_flag == 1
int max_part_nr;
int dp_mode; //!< data partioning mode
int next_header;
// int last_mb_nr; //!< only valid when entropy coding == CABAC
DataPartition *partArr; //!< array of partitions
MotionInfoContexts *mot_ctx; //!< pointer to struct of context models for use in CABAC
TextureInfoContexts *tex_ctx; //!< pointer to struct of context models for use in CABAC
 
int ref_pic_list_reordering_flag_l0;
int *reordering_of_pic_nums_idc_l0;
int *abs_diff_pic_num_minus1_l0;
int *long_term_pic_idx_l0;
int ref_pic_list_reordering_flag_l1;
int *reordering_of_pic_nums_idc_l1;
int *abs_diff_pic_num_minus1_l1;
int *long_term_pic_idx_l1;
 
int (*readSlice)(struct img_par *, struct inp_par *);
 
int LFDisableIdc; //!< Disable loop filter on slice
int LFAlphaC0Offset; //!< Alpha and C0 offset for filtering slice
int LFBetaOffset; //!< Beta offset for filtering slice
 
int pic_parameter_set_id; //!<the ID of the picture parameter set the slice is reffering to
 
} Slice;
 
//****************************** ~DM ***********************************
 
// image parameters
typedef struct img_par
{
int number; //!< frame number
unsigned int current_mb_nr; // bitstream order
unsigned int num_dec_mb;
int current_slice_nr;
int *intra_block;
int tr; //!< temporal reference, 8 bit, wrapps at 255
int qp; //!< quant for the current frame
int qpsp; //!< quant for SP-picture predicted frame
int sp_switch; //!< 1 for switching sp, 0 for normal sp
int direct_spatial_mv_pred_flag; //!< 1 for Spatial Direct, 0 for Temporal
int type; //!< image type INTER/INTRA
int width;
int height;
int width_cr; //!< width chroma
int width_cr_m1; //!< width chroma
int height_cr; //!< height chroma
int mb_y;
int mb_x;
int block_y;
int pix_y;
int pix_x;
int pix_c_y;
int block_x;
int pix_c_x;
 
int allrefzero;
imgpel mpr[16][16]; //!< predicted block
int mvscale[6][MAX_REFERENCE_PICTURES];
int m7[16][16]; //!< final 4x4 block. Extended to 16x16 for ABT
int cof[4][12][4][4]; //!< correction coefficients from predicted
int cofu[16];
byte **ipredmode; //!< prediction type [90][74]
int *quad;
int ***nz_coeff;
int **siblock;
int cod_counter; //!< Current count of number of skipped macroblocks in a row
 
int newframe;
 
int structure; //!< Identify picture structure type
int pstruct_next_P;
 
// B pictures
Slice *currentSlice; //!< pointer to current Slice data struct
Macroblock *mb_data; //!< array containing all MBs of a whole frame
int subblock_x;
int subblock_y;
int is_intra_block;
int is_v_block;
 
// For MB level frame/field coding
int MbaffFrameFlag;
 
// for signalling to the neighbour logic that this is a deblocker call
int DeblockCall;
 
DecRefPicMarking_t *dec_ref_pic_marking_buffer; //!< stores the memory management control operations
 
int num_ref_idx_l0_active; //!< number of forward reference
int num_ref_idx_l1_active; //!< number of backward reference
 
int slice_group_change_cycle;
 
int redundant_pic_cnt;
 
int explicit_B_prediction;
 
unsigned int pre_frame_num; //!< store the frame_num in the last decoded slice. For detecting gap in frame_num.
 
// End JVT-D101
// POC200301: from unsigned int to int
int toppoc; //poc for this top field // POC200301
int bottompoc; //poc of bottom field of frame
int framepoc; //poc of this frame // POC200301
unsigned int frame_num; //frame_num for this frame
unsigned int field_pic_flag;
unsigned int bottom_field_flag;
 
//the following is for slice header syntax elements of poc
// for poc mode 0.
unsigned int pic_order_cnt_lsb;
int delta_pic_order_cnt_bottom;
// for poc mode 1.
int delta_pic_order_cnt[3];
 
// ////////////////////////
// for POC mode 0:
signed int PrevPicOrderCntMsb;
unsigned int PrevPicOrderCntLsb;
signed int PicOrderCntMsb;
 
// for POC mode 1:
unsigned int AbsFrameNum;
signed int ExpectedPicOrderCnt, PicOrderCntCycleCnt, FrameNumInPicOrderCntCycle;
unsigned int PreviousFrameNum, FrameNumOffset;
int ExpectedDeltaPerPicOrderCntCycle;
int PreviousPOC, ThisPOC;
int PreviousFrameNumOffset;
// /////////////////////////
 
//weighted prediction
unsigned int luma_log2_weight_denom;
unsigned int chroma_log2_weight_denom;
int ***wp_weight; // weight in [list][index][component] order
int ***wp_offset; // offset in [list][index][component] order
int ****wbp_weight; //weight in [list][fw_index][bw_index][component] order
int wp_round_luma;
int wp_round_chroma;
unsigned int apply_weights;
 
int idr_flag;
int nal_reference_idc; //!< nal_reference_idc from NAL unit
 
int idr_pic_id;
 
int MaxFrameNum;
 
unsigned int PicWidthInMbs;
unsigned int PicHeightInMapUnits;
unsigned int FrameHeightInMbs;
unsigned int PicHeightInMbs;
unsigned int PicSizeInMbs;
unsigned int FrameSizeInMbs;
unsigned int oldFrameSizeInMbs;
 
int no_output_of_prior_pics_flag;
int long_term_reference_flag;
int adaptive_ref_pic_buffering_flag;
 
int last_has_mmco_5;
int last_pic_bottom_field;
 
int model_number;
 
// Fidelity Range Extensions Stuff
int pic_unit_bitsize_on_disk;
int bitdepth_luma;
int bitdepth_chroma;
int bitdepth_luma_qp_scale;
int bitdepth_chroma_qp_scale;
unsigned int dc_pred_value_luma; //!< luma value for DC prediction (depends on luma pel bit depth)
unsigned int dc_pred_value_chroma; //!< chroma value for DC prediction (depends on chroma pel bit depth)
int max_imgpel_value; //!< max value that one luma picture element (pixel) can take (depends on pic_unit_bitdepth)
int max_imgpel_value_uv; //!< max value that one chroma picture element (pixel) can take (depends on pic_unit_bitdepth)
int Transform8x8Mode;
int profile_idc;
int yuv_format;
int lossless_qpprime_flag;
int num_blk8x8_uv;
int num_cdc_coeff;
int mb_cr_size_x;
int mb_cr_size_y;
int mb_cr_size_x_blk;
int mb_cr_size_y_blk;
int mb_size[3][2]; //!< component macroblock dimensions
int mb_size_blk[3][2]; //!< component macroblock dimensions
 
int idr_psnr_number;
int psnr_number;
 
time_t ltime_start; // for time measurement
time_t ltime_end; // for time measurement
 
#ifdef WIN32
struct _timeb tstruct_start;
struct _timeb tstruct_end;
#else
struct timeb tstruct_start;
struct timeb tstruct_end;
#endif
 
// picture error concealment
int last_ref_pic_poc;
int ref_poc_gap;
int poc_gap;
int conceal_mode;
int earlier_missing_poc;
unsigned int frame_to_conceal;
int IDR_concealment_flag;
int conceal_slice_type;
 
// random access point decoding
int recovery_point;
int recovery_point_found;
int recovery_frame_cnt;
int recovery_frame_num;
int recovery_poc;
 
} ImageParameters;
 
extern ImageParameters *img;
extern struct snr_par *snr;
 
// signal to noise ratio parameters
struct snr_par
{
int frame_ctr;
float snr_y; //!< current Y SNR
float snr_u; //!< current U SNR
float snr_v; //!< current V SNR
float snr_y1; //!< SNR Y(dB) first frame
float snr_u1; //!< SNR U(dB) first frame
float snr_v1; //!< SNR V(dB) first frame
float snr_ya; //!< Average SNR Y(dB) remaining frames
float snr_ua; //!< Average SNR U(dB) remaining frames
float snr_va; //!< Average SNR V(dB) remaining frames
float sse_y; //!< SSE Y
float sse_u; //!< SSE U
float sse_v; //!< SSE V
float msse_y; //!< Average SSE Y
float msse_u; //!< Average SSE U
float msse_v; //!< Average SSE V
};
 
time_t tot_time;
 
// input parameters from configuration file
struct inp_par
{
char infile[100]; //!< H.264 inputfile
char outfile[100]; //!< Decoded YUV 4:2:0 output
char reffile[100]; //!< Optional YUV 4:2:0 reference file for SNR measurement
int FileFormat; //!< File format of the Input file, PAR_OF_ANNEXB or PAR_OF_RTP
int ref_offset;
int poc_scale;
int write_uv;
int silent;
 
#ifdef _LEAKYBUCKET_
unsigned long R_decoder; //!< Decoder Rate in HRD Model
unsigned long B_decoder; //!< Decoder Buffer size in HRD model
unsigned long F_decoder; //!< Decoder Initial buffer fullness in HRD model
char LeakyBucketParamFile[100]; //!< LeakyBucketParamFile
#endif
 
// picture error concealment
int conceal_mode;
int ref_poc_gap;
int poc_gap;
 
};
 
extern struct inp_par *input;
 
typedef struct pix_pos
{
int available;
int mb_addr;
int x;
int y;
int pos_x;
int pos_y;
} PixelPos;
 
typedef struct old_slice_par
{
unsigned field_pic_flag;
unsigned bottom_field_flag;
unsigned frame_num;
int nal_ref_idc;
unsigned pic_oder_cnt_lsb;
int delta_pic_oder_cnt_bottom;
int delta_pic_order_cnt[2];
int idr_flag;
int idr_pic_id;
int pps_id;
} OldSliceParams;
 
extern OldSliceParams old_slice;
 
// files
int p_out; //!< file descriptor to output YUV file
//FILE *p_out2; //!< pointer to debug output YUV file
int p_ref; //!< pointer to input original reference YUV file file
 
FILE *p_log; //!< SNR file
 
#if TRACE
FILE *p_trace;
#endif
 
// Redundant slices
unsigned int previous_frame_num; //!< frame number of previous slice
int ref_flag[17]; //!< 0: i-th previous frame is incorrect
//!< non-zero: i-th previous frame is correct
int Is_primary_correct; //!< if primary frame is correct, 0: incorrect
int Is_redundant_correct; //!< if redundant frame is correct, 0:incorrect
int redundant_slice_ref_idx; //!< reference index of redundant slice
void Error_tracking(void);
 
// prototypes
void init_conf(struct inp_par *inp, char *config_filename);
void report(struct inp_par *inp, struct img_par *img, struct snr_par *snr);
void init(struct img_par *img);
 
void malloc_slice(struct inp_par *inp, struct img_par *img);
void free_slice(struct inp_par *inp, struct img_par *img);
 
int decode_one_frame(struct img_par *img,struct inp_par *inp, struct snr_par *snr);
void init_picture(struct img_par *img, struct inp_par *inp);
void exit_picture();
 
int read_new_slice();
void decode_one_slice(struct img_par *img,struct inp_par *inp);
 
void start_macroblock(struct img_par *img,int CurrentMBInScanOrder);
int read_one_macroblock(struct img_par *img,struct inp_par *inp);
void read_ipred_modes(struct img_par *img,struct inp_par *inp);
int decode_one_macroblock(struct img_par *img,struct inp_par *inp);
Boolean exit_macroblock(struct img_par *img,struct inp_par *inp, int eos_bit);
void decode_ipcm_mb(struct img_par *img);
 
 
void readMotionInfoFromNAL (struct img_par *img,struct inp_par *inp);
void readCBPandCoeffsFromNAL(struct img_par *img,struct inp_par *inp);
void readIPCMcoeffsFromNAL(struct img_par *img, struct inp_par *inp, struct datapartition *dP);
 
void readLumaCoeff8x8_CABAC (struct img_par *img,struct inp_par *inp, int b8);
void itrans8x8(struct img_par *img, int ioff, int joff);
 
void copyblock_sp(struct img_par *img,int block_x,int block_y);
void itrans_sp_chroma(struct img_par *img,int ll);
void itrans(struct img_par *img,int ioff,int joff,int i0,int j0, int chroma);
void itrans_sp(struct img_par *img,int ioff,int joff,int i0,int j0);
int intrapred(struct img_par *img,int ioff,int joff,int i4,int j4);
void itrans_2(struct img_par *img);
int intrapred_luma_16x16(struct img_par *img,int predmode);
void intrapred_chroma(struct img_par *img, int uv);
 
// SLICE function pointers
int (*nal_startcode_follows) (struct img_par*, int );
 
// NAL functions TML/CABAC bitstream
int uvlc_startcode_follows(struct img_par *img, int dummy);
int cabac_startcode_follows(struct img_par *img, int eos_bit);
void free_Partition(Bitstream *currStream);
 
// ErrorConcealment
void reset_ec_flags();
 
void error(char *text, int code);
int is_new_picture();
void init_old_slice();
 
// dynamic mem allocation
int init_global_buffers();
void free_global_buffers();
 
void frame_postprocessing(struct img_par *img, struct inp_par *inp);
void field_postprocessing(struct img_par *img, struct inp_par *inp);
int bottom_field_picture(struct img_par *img,struct inp_par *inp);
void decode_slice(struct img_par *img,struct inp_par *inp, int current_header);
 
int RBSPtoSODB(byte *streamBuffer, int last_byte_pos);
int EBSPtoRBSP(byte *streamBuffer, int end_bytepos, int begin_bytepos);
 
// For MB level frame/field coding
void init_super_macroblock(struct img_par *img,struct inp_par *inp);
void exit_super_macroblock(struct img_par *img,struct inp_par *inp);
int decode_super_macroblock(struct img_par *img,struct inp_par *inp);
void decode_one_Copy_topMB(struct img_par *img,struct inp_par *inp);
 
void SetOneRefMV(struct img_par* img);
int peekSyntaxElement_UVLC(SyntaxElement *sym, struct img_par *img, struct datapartition *dP);
 
void fill_wp_params(struct img_par *img);
 
void reset_wp_params(struct img_par *img);
 
void FreePartition (DataPartition *dp, int n);
DataPartition *AllocPartition();
 
void tracebits2(const char *trace_str, int len, int info);
 
void init_decoding_engine_IPCM(struct img_par *img);
void readIPCMBytes_CABAC(SyntaxElement *sym, Bitstream *currStream);
 
unsigned CeilLog2( unsigned uiVal);
 
// For Q-matrix
void AssignQuantParam(pic_parameter_set_rbsp_t* pps, seq_parameter_set_rbsp_t* sps);
void CalculateQuantParam(void);
void CalculateQuant8Param(void);
 
#endif
 
 
/errorconcealment.h
0,0 → 1,21
 
 
/*!
****************************************************************************
* \file errorconcealment.h
*
* \brief
* Header file for errorconcealment.c
*
****************************************************************************
*/
 
#ifndef _ERRORCONCEALMENT_H_
#define _ERRORCONCEALMENT_H_
 
int set_ec_flag(int se);
void reset_ec_flags();
int get_concealed_element(SyntaxElement *sym);
 
#endif
 
/rtp.h
0,0 → 1,48
 
/*!
*************************************************************************************
* \file rtp.h
*
* \brief
* Prototypes for rtp.c
*************************************************************************************
*/
 
#ifndef _RTP_H_
#define _RTP_H_
 
#include "nalucommon.h"
 
#define MAXRTPPAYLOADLEN (65536 - 40) //!< Maximum payload size of an RTP packet */
#define MAXRTPPACKETSIZE (65536 - 28) //!< Maximum size of an RTP packet incl. header */
#define H264PAYLOADTYPE 105 //!< RTP paylaod type fixed here for simplicity*/
#define H264SSRC 0x12345678 //!< SSRC, chosen to simplify debugging */
#define RTP_TR_TIMESTAMP_MULT 1000 //!< should be something like 27 Mhz / 29.97 Hz */
 
typedef struct
{
unsigned int v; //!< Version, 2 bits, MUST be 0x2
unsigned int p; //!< Padding bit, Padding MUST NOT be used
unsigned int x; //!< Extension, MUST be zero
unsigned int cc; /*!< CSRC count, normally 0 in the absence
of RTP mixers */
unsigned int m; //!< Marker bit
unsigned int pt; //!< 7 bits, Payload Type, dynamically established
unsigned int seq; /*!< RTP sequence number, incremented by one for
each sent packet */
unsigned int old_seq; //!< to detect wether packets were lost
unsigned int timestamp; //!< timestamp, 27 MHz for H.264
unsigned int ssrc; //!< Synchronization Source, chosen randomly
byte * payload; //!< the payload including payload headers
unsigned int paylen; //!< length of payload in bytes
byte * packet; //!< complete packet including header and payload
unsigned int packlen; //!< length of packet, typically paylen+12
} RTPpacket_t;
 
void DumpRTPHeader (RTPpacket_t *p);
 
int GetRTPNALU (NALU_t *nalu);
void OpenRTPFile (char *fn);
void CloseRTPFile();
 
#endif
/parsetcommon.h
0,0 → 1,214
 
/*!
**************************************************************************************
* \file
* parsetcommon.h
* \brief
* Picture and Sequence Parameter Sets, structures common to encoder and decoder
* This code reflects JVT version xxx
* \date 25 November 2002
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Stephan Wenger <stewe@cs.tu-berlin.de>
***************************************************************************************
*/
 
 
 
// In the JVT syntax, frequently flags are used that indicate the presence of
// certain pieces of information in the NALU. Here, these flags are also
// present. In the encoder, those bits indicate that the values signalled to
// be present are meaningful and that this part of the syntax should be
// written to the NALU. In the decoder, the flag indicates that information
// was received from the decoded NALU and should be used henceforth.
// The structure names were chosen as indicated in the JVT syntax
 
#ifndef _PARSETCOMMON_H_
#define _PARSETCOMMON_H_
 
#include "defines.h"
 
#define MAXIMUMPARSETRBSPSIZE 1500
#define MAXIMUMPARSETNALUSIZE 1500
#define SIZEslice_group_id (sizeof (int) * 60000) // should be sufficient for HUGE pictures, need one int per MB in a picture
 
#define MAXSPS 32
#define MAXPPS 256
 
//! Boolean Type
#ifdef FALSE
# define Boolean int
#else
typedef enum {
FALSE,
TRUE
} Boolean;
#endif
 
#define MAXIMUMVALUEOFcpb_cnt 32
typedef struct
{
unsigned int cpb_cnt_minus1; // ue(v)
unsigned int bit_rate_scale; // u(4)
unsigned int cpb_size_scale; // u(4)
unsigned int bit_rate_value_minus1 [MAXIMUMVALUEOFcpb_cnt]; // ue(v)
unsigned int cpb_size_value_minus1 [MAXIMUMVALUEOFcpb_cnt]; // ue(v)
unsigned int cbr_flag [MAXIMUMVALUEOFcpb_cnt]; // u(1)
unsigned int initial_cpb_removal_delay_length_minus1; // u(5)
unsigned int cpb_removal_delay_length_minus1; // u(5)
unsigned int dpb_output_delay_length_minus1; // u(5)
unsigned int time_offset_length; // u(5)
} hrd_parameters_t;
 
 
typedef struct
{
Boolean aspect_ratio_info_present_flag; // u(1)
unsigned int aspect_ratio_idc; // u(8)
unsigned int sar_width; // u(16)
unsigned int sar_height; // u(16)
Boolean overscan_info_present_flag; // u(1)
Boolean overscan_appropriate_flag; // u(1)
Boolean video_signal_type_present_flag; // u(1)
unsigned video_format; // u(3)
Boolean video_full_range_flag; // u(1)
Boolean colour_description_present_flag; // u(1)
unsigned int colour_primaries; // u(8)
unsigned int transfer_characteristics; // u(8)
unsigned int matrix_coefficients; // u(8)
Boolean chroma_location_info_present_flag; // u(1)
unsigned int chroma_sample_loc_type_top_field; // ue(v)
unsigned int chroma_sample_loc_type_bottom_field; // ue(v)
Boolean timing_info_present_flag; // u(1)
unsigned int num_units_in_tick; // u(32)
unsigned int time_scale; // u(32)
Boolean fixed_frame_rate_flag; // u(1)
Boolean nal_hrd_parameters_present_flag; // u(1)
hrd_parameters_t nal_hrd_parameters; // hrd_paramters_t
Boolean vcl_hrd_parameters_present_flag; // u(1)
hrd_parameters_t vcl_hrd_parameters; // hrd_paramters_t
// if ((nal_hrd_parameters_present_flag || (vcl_hrd_parameters_present_flag))
Boolean low_delay_hrd_flag; // u(1)
Boolean pic_struct_present_flag; // u(1)
Boolean bitstream_restriction_flag; // u(1)
Boolean motion_vectors_over_pic_boundaries_flag; // u(1)
unsigned int max_bytes_per_pic_denom; // ue(v)
unsigned int max_bits_per_mb_denom; // ue(v)
unsigned int log2_max_mv_length_vertical; // ue(v)
unsigned int log2_max_mv_length_horizontal; // ue(v)
unsigned int num_reorder_frames; // ue(v)
unsigned int max_dec_frame_buffering; // ue(v)
} vui_seq_parameters_t;
 
 
#define MAXnum_slice_groups_minus1 8
typedef struct
{
Boolean Valid; // indicates the parameter set is valid
unsigned int pic_parameter_set_id; // ue(v)
unsigned int seq_parameter_set_id; // ue(v)
Boolean entropy_coding_mode_flag; // u(1)
 
Boolean transform_8x8_mode_flag; // u(1)
 
Boolean pic_scaling_matrix_present_flag; // u(1)
int pic_scaling_list_present_flag[8]; // u(1)
int ScalingList4x4[6][16]; // se(v)
int ScalingList8x8[2][64]; // se(v)
Boolean UseDefaultScalingMatrix4x4Flag[6];
Boolean UseDefaultScalingMatrix8x8Flag[2];
 
// if( pic_order_cnt_type < 2 ) in the sequence parameter set
Boolean pic_order_present_flag; // u(1)
unsigned int num_slice_groups_minus1; // ue(v)
unsigned int slice_group_map_type; // ue(v)
// if( slice_group_map_type = = 0 )
unsigned int run_length_minus1[MAXnum_slice_groups_minus1]; // ue(v)
// else if( slice_group_map_type = = 2 )
unsigned int top_left[MAXnum_slice_groups_minus1]; // ue(v)
unsigned int bottom_right[MAXnum_slice_groups_minus1]; // ue(v)
// else if( slice_group_map_type = = 3 || 4 || 5
Boolean slice_group_change_direction_flag; // u(1)
unsigned int slice_group_change_rate_minus1; // ue(v)
// else if( slice_group_map_type = = 6 )
unsigned int num_slice_group_map_units_minus1; // ue(v)
unsigned int *slice_group_id; // complete MBAmap u(v)
unsigned int num_ref_idx_l0_active_minus1; // ue(v)
unsigned int num_ref_idx_l1_active_minus1; // ue(v)
Boolean weighted_pred_flag; // u(1)
unsigned int weighted_bipred_idc; // u(2)
int pic_init_qp_minus26; // se(v)
int pic_init_qs_minus26; // se(v)
int chroma_qp_index_offset; // se(v)
 
int second_chroma_qp_index_offset; // se(v)
 
Boolean deblocking_filter_control_present_flag; // u(1)
Boolean constrained_intra_pred_flag; // u(1)
Boolean redundant_pic_cnt_present_flag; // u(1)
} pic_parameter_set_rbsp_t;
 
 
#define MAXnum_ref_frames_in_pic_order_cnt_cycle 256
typedef struct
{
Boolean Valid; // indicates the parameter set is valid
 
unsigned int profile_idc; // u(8)
Boolean constrained_set0_flag; // u(1)
Boolean constrained_set1_flag; // u(1)
Boolean constrained_set2_flag; // u(1)
Boolean constrained_set3_flag; // u(1)
unsigned int level_idc; // u(8)
unsigned int seq_parameter_set_id; // ue(v)
unsigned int chroma_format_idc; // ue(v)
 
Boolean seq_scaling_matrix_present_flag; // u(1)
int seq_scaling_list_present_flag[8]; // u(1)
int ScalingList4x4[6][16]; // se(v)
int ScalingList8x8[2][64]; // se(v)
Boolean UseDefaultScalingMatrix4x4Flag[6];
Boolean UseDefaultScalingMatrix8x8Flag[2];
 
unsigned int bit_depth_luma_minus8; // ue(v)
unsigned int bit_depth_chroma_minus8; // ue(v)
 
unsigned int log2_max_frame_num_minus4; // ue(v)
unsigned int pic_order_cnt_type;
// if( pic_order_cnt_type == 0 )
unsigned log2_max_pic_order_cnt_lsb_minus4; // ue(v)
// else if( pic_order_cnt_type == 1 )
Boolean delta_pic_order_always_zero_flag; // u(1)
int offset_for_non_ref_pic; // se(v)
int offset_for_top_to_bottom_field; // se(v)
unsigned int num_ref_frames_in_pic_order_cnt_cycle; // ue(v)
// for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ )
int offset_for_ref_frame[MAXnum_ref_frames_in_pic_order_cnt_cycle]; // se(v)
unsigned int num_ref_frames; // ue(v)
Boolean gaps_in_frame_num_value_allowed_flag; // u(1)
unsigned int pic_width_in_mbs_minus1; // ue(v)
unsigned int pic_height_in_map_units_minus1; // ue(v)
Boolean frame_mbs_only_flag; // u(1)
// if( !frame_mbs_only_flag )
Boolean mb_adaptive_frame_field_flag; // u(1)
Boolean direct_8x8_inference_flag; // u(1)
Boolean frame_cropping_flag; // u(1)
unsigned int frame_cropping_rect_left_offset; // ue(v)
unsigned int frame_cropping_rect_right_offset; // ue(v)
unsigned int frame_cropping_rect_top_offset; // ue(v)
unsigned int frame_cropping_rect_bottom_offset; // ue(v)
Boolean vui_parameters_present_flag; // u(1)
vui_seq_parameters_t vui_seq_parameters; // vui_seq_parameters_t
} seq_parameter_set_rbsp_t;
 
 
pic_parameter_set_rbsp_t *AllocPPS ();
seq_parameter_set_rbsp_t *AllocSPS ();
 
void FreePPS (pic_parameter_set_rbsp_t *pps);
void FreeSPS (seq_parameter_set_rbsp_t *sps);
 
int sps_is_equal(seq_parameter_set_rbsp_t *sps1, seq_parameter_set_rbsp_t *sps2);
int pps_is_equal(pic_parameter_set_rbsp_t *pps1, pic_parameter_set_rbsp_t *pps2);
 
#endif
/nalucommon.h
0,0 → 1,55
 
/*!
**************************************************************************************
* \file
* nalucommon.h.h
* \brief
* NALU handling common to encoder and decoder
* \date 25 November 2002
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Stephan Wenger <stewe@cs.tu-berlin.de>
***************************************************************************************
*/
 
 
#ifndef _NALUCOMMON_H_
#define _NALUCOMMON_H_
 
#define MAXRBSPSIZE 64000
 
#define NALU_TYPE_SLICE 1
#define NALU_TYPE_DPA 2
#define NALU_TYPE_DPB 3
#define NALU_TYPE_DPC 4
#define NALU_TYPE_IDR 5
#define NALU_TYPE_SEI 6
#define NALU_TYPE_SPS 7
#define NALU_TYPE_PPS 8
#define NALU_TYPE_AUD 9
#define NALU_TYPE_EOSEQ 10
#define NALU_TYPE_EOSTREAM 11
#define NALU_TYPE_FILL 12
 
#define NALU_PRIORITY_HIGHEST 3
#define NALU_PRIORITY_HIGH 2
#define NALU_PRIRITY_LOW 1
#define NALU_PRIORITY_DISPOSABLE 0
 
 
typedef struct
{
int startcodeprefix_len; //! 4 for parameter sets and first slice in picture, 3 for everything else (suggested)
unsigned len; //! Length of the NAL unit (Excluding the start code, which does not belong to the NALU)
unsigned max_size; //! Nal Unit Buffer size
int nal_unit_type; //! NALU_TYPE_xxxx
int nal_reference_idc; //! NALU_PRIORITY_xxxx
int forbidden_bit; //! should be always FALSE
byte *buf; //! conjtains the first byte followed by the EBSP
} NALU_t;
 
 
NALU_t *AllocNALU();
void FreeNALU(NALU_t *n);
 
#endif
/annexb.h
0,0 → 1,28
 
/*!
*************************************************************************************
* \file annexb.h
*
* \brief
* Annex B byte stream buffer handling.
*
*************************************************************************************
*/
 
#ifndef _ANNEXB_H_
#define _ANNEXB_H_
 
#include "nalucommon.h"
 
extern int IsFirstByteStreamNALU;
extern int LastAccessUnitExists;
extern int NALUCount;
 
int GetAnnexbNALU (NALU_t *nalu);
void OpenBitstreamFile (char *fn);
void CloseBitstreamFile();
void CheckZeroByteNonVCL(NALU_t *nalu, int * ret);
void CheckZeroByteVCL(NALU_t *nalu, int * ret);
 
#endif
 
/erc_globals.h
0,0 → 1,52
 
/*!
************************************************************************
* \file erc_globals.h
*
* \brief
* global header file for error concealment module
*
* \author
* - Viktor Varsa <viktor.varsa@nokia.com>
* - Ye-Kui Wang <wyk@ieee.org>
************************************************************************
*/
 
#ifndef _ERC_GLOBALS_H_
#define _ERC_GLOBALS_H_
 
#include <string.h>
#include "defines.h"
 
/* "block" means an 8x8 pixel area */
 
/* Region modes */
#define REGMODE_INTER_COPY 0 //!< Copy region
#define REGMODE_INTER_PRED 1 //!< Inter region with motion vectors
#define REGMODE_INTRA 2 //!< Intra region
#define REGMODE_SPLITTED 3 //!< Any region mode higher than this indicates that the region
//!< is splitted which means 8x8 block
#define REGMODE_INTER_COPY_8x8 4
#define REGMODE_INTER_PRED_8x8 5
#define REGMODE_INTRA_8x8 6
 
//! YUV pixel domain image arrays for a video frame
typedef struct
{
imgpel *yptr;
imgpel *uptr;
imgpel *vptr;
} frame;
 
//! region structure stores information about a region that is needed for concealment
typedef struct
{
byte regionMode; //!< region mode as above
int xMin; //!< X coordinate of the pixel position of the top-left corner of the region
int yMin; //!< Y coordinate of the pixel position of the top-left corner of the region
int mv[3]; //!< motion vectors in 1/4 pixel units: mvx = mv[0], mvy = mv[1],
//!< and ref_frame = mv[2]
} objectBuffer_t;
 
#endif
 
/macroblock.h
0,0 → 1,335
 
/*!
************************************************************************
* \file macroblock.h
*
* \brief
* Arrays for macroblock encoding
*
* \author
* Inge Lille-Langoy <inge.lille-langoy@telenor.com>
* Copyright (C) 1999 Telenor Satellite Services, Norway
************************************************************************
*/
 
#ifndef _MACROBLOCK_H_
#define _MACROBLOCK_H_
 
 
//! single scan pattern
const byte SNGL_SCAN[16][2] =
{
{0,0},{1,0},{0,1},{0,2},
{1,1},{2,0},{3,0},{2,1},
{1,2},{0,3},{1,3},{2,2},
{3,1},{3,2},{2,3},{3,3}
};
 
//! field scan pattern
const byte FIELD_SCAN[16][2] =
{
{0,0},{0,1},{1,0},{0,2},
{0,3},{1,1},{1,2},{1,3},
{2,0},{2,1},{2,2},{2,3},
{3,0},{3,1},{3,2},{3,3}
};
 
 
//! gives CBP value from codeword number, both for intra and inter
const unsigned char NCBP[2][48][2]=
{
{ // 0 1 2 3 4 5 6 7 8 9 10 11
{15, 0},{ 0, 1},{ 7, 2},{11, 4},{13, 8},{14, 3},{ 3, 5},{ 5,10},{10,12},{12,15},{ 1, 7},{ 2,11},
{ 4,13},{ 8,14},{ 6, 6},{ 9, 9},{ 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},
{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0}
},
{
{47, 0},{31,16},{15, 1},{ 0, 2},{23, 4},{27, 8},{29,32},{30, 3},{ 7, 5},{11,10},{13,12},{14,15},
{39,47},{43, 7},{45,11},{46,13},{16,14},{ 3, 6},{ 5, 9},{10,31},{12,35},{19,37},{21,42},{26,44},
{28,33},{35,34},{37,36},{42,40},{44,39},{ 1,43},{ 2,45},{ 4,46},{ 8,17},{17,18},{18,20},{20,24},
{24,19},{ 6,21},{ 9,26},{22,28},{25,23},{32,27},{33,29},{34,30},{36,22},{40,25},{38,38},{41,41}
}
};
 
 
//! used to control block sizes : Not used/16x16/16x8/8x16/8x8/8x4/4x8/4x4
const int BLOCK_STEP[8][2]=
{
{0,0},{4,4},{4,2},{2,4},{2,2},{2,1},{1,2},{1,1}
};
 
//! Dequantization coefficients
const int dequant_coef[6][4][4] = {
{{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}}
};
 
const byte QP_SCALE_CR[52]=
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,
12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,
28,29,29,30,31,32,32,33,34,34,35,35,36,36,37,37,
37,38,38,38,39,39,39,39
 
};
 
//! single scan pattern
const byte SNGL_SCAN8x8[64][2] = {
{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}
};
 
/*
//! field scan pattern
const byte FIELD_SCAN8x8[64][2] = {
{0,0}, {0,1}, {0,2}, {1,0}, {1,1}, {0,3}, {0,4}, {1,2}, {2,0}, {2,1}, {1,3}, {0,5}, {0,6}, {1,4}, {2,2}, {3,0},
{3,1}, {2,3}, {1,5}, {0,7}, {1,6}, {2,4}, {3,2}, {4,0}, {4,1}, {3,3}, {2,5}, {1,7}, {2,6}, {3,4}, {4,2}, {5,0},
{5,1}, {4,3}, {3,5}, {2,7}, {3,6}, {4,4}, {5,2}, {6,0}, {6,1}, {5,3}, {4,5}, {3,7}, {4,6}, {5,4}, {6,2}, {7,0},
{7,1}, {6,3}, {5,5}, {4,7}, {5,6}, {6,4}, {7,2}, {7,3}, {6,5}, {5,7}, {6,6}, {7,4}, {7,5}, {6,7}, {7,6}, {7,7}
};
*/
 
//! field scan pattern
//original from ABT
const byte FIELD_SCAN8x8[64][2] = { // 8x8
{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}
};
 
 
static const int dequant_coef8[6][8][8] =
{
{
{20, 19, 25, 19, 20, 19, 25, 19},
{19, 18, 24, 18, 19, 18, 24, 18},
{25, 24, 32, 24, 25, 24, 32, 24},
{19, 18, 24, 18, 19, 18, 24, 18},
{20, 19, 25, 19, 20, 19, 25, 19},
{19, 18, 24, 18, 19, 18, 24, 18},
{25, 24, 32, 24, 25, 24, 32, 24},
{19, 18, 24, 18, 19, 18, 24, 18}
},
{
{22, 21, 28, 21, 22, 21, 28, 21},
{21, 19, 26, 19, 21, 19, 26, 19},
{28, 26, 35, 26, 28, 26, 35, 26},
{21, 19, 26, 19, 21, 19, 26, 19},
{22, 21, 28, 21, 22, 21, 28, 21},
{21, 19, 26, 19, 21, 19, 26, 19},
{28, 26, 35, 26, 28, 26, 35, 26},
{21, 19, 26, 19, 21, 19, 26, 19}
},
{
{26, 24, 33, 24, 26, 24, 33, 24},
{24, 23, 31, 23, 24, 23, 31, 23},
{33, 31, 42, 31, 33, 31, 42, 31},
{24, 23, 31, 23, 24, 23, 31, 23},
{26, 24, 33, 24, 26, 24, 33, 24},
{24, 23, 31, 23, 24, 23, 31, 23},
{33, 31, 42, 31, 33, 31, 42, 31},
{24, 23, 31, 23, 24, 23, 31, 23}
},
{
{28, 26, 35, 26, 28, 26, 35, 26},
{26, 25, 33, 25, 26, 25, 33, 25},
{35, 33, 45, 33, 35, 33, 45, 33},
{26, 25, 33, 25, 26, 25, 33, 25},
{28, 26, 35, 26, 28, 26, 35, 26},
{26, 25, 33, 25, 26, 25, 33, 25},
{35, 33, 45, 33, 35, 33, 45, 33},
{26, 25, 33, 25, 26, 25, 33, 25}
},
{
{32, 30, 40, 30, 32, 30, 40, 30},
{30, 28, 38, 28, 30, 28, 38, 28},
{40, 38, 51, 38, 40, 38, 51, 38},
{30, 28, 38, 28, 30, 28, 38, 28},
{32, 30, 40, 30, 32, 30, 40, 30},
{30, 28, 38, 28, 30, 28, 38, 28},
{40, 38, 51, 38, 40, 38, 51, 38},
{30, 28, 38, 28, 30, 28, 38, 28}
},
{
{36, 34, 46, 34, 36, 34, 46, 34},
{34, 32, 43, 32, 34, 32, 43, 32},
{46, 43, 58, 43, 46, 43, 58, 43},
{34, 32, 43, 32, 34, 32, 43, 32},
{36, 34, 46, 34, 36, 34, 46, 34},
{34, 32, 43, 32, 34, 32, 43, 32},
{46, 43, 58, 43, 46, 43, 58, 43},
{34, 32, 43, 32, 34, 32, 43, 32}
}
 
};
 
//! single scan pattern
const byte SCAN_YUV422[8][2] =
{
{0,0},{0,1},
{1,0},{0,2},
{0,3},{1,1},
{1,2},{1,3}
};
 
//! look up tables for FRExt_chroma support
const unsigned char subblk_offset_x[3][8][4] =
{
{ {0, 4, 0, 4},
{0, 4, 0, 4},
{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, 4, 0, 4},
{0, 4, 0, 4},
{0, 4, 0, 4},
{0, 4, 0, 4},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}, },
 
{ {0, 4, 0, 4},
{8,12, 8,12},
{0, 4, 0, 4},
{8,12, 8,12},
{0, 4, 0, 4},
{8,12, 8,12},
{0, 4, 0, 4},
{8,12, 8,12} }
};
 
const unsigned char subblk_offset_y[3][8][4] =
{ { {0, 0, 4, 4},
{0, 0, 4, 4},
{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, 4, 4},
{8, 8,12,12},
{0, 0, 4, 4},
{8, 8,12,12},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0} },
 
{ {0, 0, 4, 4},
{0, 0, 4, 4},
{8, 8,12,12},
{8, 8,12,12},
{0, 0, 4, 4},
{0, 0, 4, 4},
{8, 8,12,12},
{8, 8,12,12} }
};
 
 
static unsigned char cofuv_blk_x[3][8][4] =
{ { {0, 1, 0, 1},
{2, 3, 2, 3},
{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, 1, 0, 1},
{0, 1, 0, 1},
{2, 3, 2, 3},
{2, 3, 2, 3},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0} },
 
{ {0, 1, 0, 1},
{2, 3, 2, 3},
{0, 1, 0, 1},
{2, 3, 2, 3},
{0, 1, 0, 1},
{2, 3, 2, 3},
{0, 1, 0, 1},
{2, 3, 2, 3} }
};
static unsigned char cofuv_blk_y[3][8][4] =
{
{ { 4, 4, 5, 5},
{ 4, 4, 5, 5},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0} },
 
{ { 4, 4, 5, 5},
{ 6, 6, 7, 7},
{ 4, 4, 5, 5},
{ 6, 6, 7, 7},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0} },
 
{ { 4, 4, 5, 5},
{ 4, 4, 5, 5},
{ 6, 6, 7, 7},
{ 6, 6, 7, 7},
{ 8, 8, 9, 9},
{ 8, 8, 9, 9},
{10,10,11,11},
{10,10,11,11} }
};
 
static unsigned char cbp_blk_chroma[8][4] =
{ {16, 17, 18, 19},
{20, 21, 22, 23},
{24, 25, 26, 27},
{28, 29, 30, 31},
{32, 33, 34, 35},
{36, 37, 38, 39},
{40, 41, 42, 43},
{44, 45, 46, 47} };
 
 
int block8x8_idx[3][4][4] =
{ { {0, 1, 2, 3},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}, },
 
{ {0, 1, 0, 1},
{2, 3, 2, 3},
{0, 0, 0, 0},
{0, 0, 0, 0} },
 
{ {0, 0, 0, 0},
{1, 1, 1, 1},
{2, 2, 2, 2},
{3, 3, 3, 3} }
};
 
#define _NEW_8x8_ARRAYS_INCLUDED_
 
 
#endif
 
/sei.h
0,0 → 1,68
 
/*!
*************************************************************************************
* \file sei.h
*
* \brief
* Prototypes for sei.c
*************************************************************************************
*/
 
#ifndef SEI_H
#define SEI_H
 
typedef enum {
SEI_BUFFERING_PERIOD = 0,
SEI_PIC_TIMING,
SEI_PAN_SCAN_RECT,
SEI_FILLER_PAYLOAD,
SEI_USER_DATA_REGISTERED_ITU_T_T35,
SEI_USER_DATA_UNREGISTERED,
SEI_RECOVERY_POINT,
SEI_DEC_REF_PIC_MARKING_REPETITION,
SEI_SPARE_PIC,
SEI_SCENE_INFO,
SEI_SUB_SEQ_INFO,
SEI_SUB_SEQ_LAYER_CHARACTERISTICS,
SEI_SUB_SEQ_CHARACTERISTICS,
SEI_FULL_FRAME_FREEZE,
SEI_FULL_FRAME_FREEZE_RELEASE,
SEI_FULL_FRAME_SNAPSHOT,
SEI_PROGRESSIVE_REFINEMENT_SEGMENT_START,
SEI_PROGRESSIVE_REFINEMENT_SEGMENT_END,
SEI_MOTION_CONSTRAINED_SLICE_GROUP_SET,
SEI_FILM_GRAIN_CHARACTERISTICS,
SEI_DEBLOCKING_FILTER_DISPLAY_PREFERENCE,
SEI_STEREO_VIDEO_INFO,
 
SEI_MAX_ELEMENTS //!< number of maximum syntax elements
} SEI_type;
 
#define MAX_FN 256
 
void InterpretSEIMessage(byte* msg, int size, ImageParameters *img);
void interpret_spare_pic( byte* payload, int size, ImageParameters *img );
void interpret_subsequence_info( byte* payload, int size, ImageParameters *img );
void interpret_subsequence_layer_characteristics_info( byte* payload, int size, ImageParameters *img );
void interpret_subsequence_characteristics_info( byte* payload, int size, ImageParameters *img );
void interpret_scene_information( byte* payload, int size, ImageParameters *img ); // JVT-D099
void interpret_user_data_registered_itu_t_t35_info( byte* payload, int size, ImageParameters *img );
void interpret_user_data_unregistered_info( byte* payload, int size, ImageParameters *img );
void interpret_pan_scan_rect_info( byte* payload, int size, ImageParameters *img );
void interpret_recovery_point_info( byte* payload, int size, ImageParameters *img );
void interpret_filler_payload_info( byte* payload, int size, ImageParameters *img );
void interpret_dec_ref_pic_marking_repetition_info( byte* payload, int size, ImageParameters *img );
void interpret_full_frame_freeze_info( byte* payload, int size, ImageParameters *img );
void interpret_full_frame_freeze_release_info( byte* payload, int size, ImageParameters *img );
void interpret_full_frame_snapshot_info( byte* payload, int size, ImageParameters *img );
void interpret_progressive_refinement_start_info( byte* payload, int size, ImageParameters *img );
void interpret_progressive_refinement_end_info( byte* payload, int size, ImageParameters *img );
void interpret_motion_constrained_slice_group_set_info( byte* payload, int size, ImageParameters *img );
void interpret_reserved_info( byte* payload, int size, ImageParameters *img );
void interpret_buffering_period_info( byte* payload, int size, ImageParameters *img );
void interpret_picture_timing_info( byte* payload, int size, ImageParameters *img );
void interpret_film_grain_characteristics_info( byte* payload, int size, ImageParameters *img );
void interpret_deblocking_filter_display_preference_info( byte* payload, int size, ImageParameters *img );
void interpret_stereo_video_info_info( byte* payload, int size, ImageParameters *img );
 
#endif
/fmo.h
0,0 → 1,30
 
/*!
***************************************************************************
*
* \file fmo.h
*
* \brief
* Support for Flexilble Macroblock Ordering (FMO)
*
* \date
* 19 June, 2002
*
* \author
* Stephan Wenger stewe@cs.tu-berlin.de
**************************************************************************/
 
#ifndef _FMO_H_
#define _FMO_H_
 
 
int FmoInit (pic_parameter_set_rbsp_t* pps, seq_parameter_set_rbsp_t* sps);
int FmoFinit ();
 
int FmoGetNumberOfSliceGroup();
int FmoGetLastMBOfPicture();
int FmoGetLastMBInSliceGroup(int SliceGroup);
int FmoGetSliceGroupId (int mb);
int FmoGetNextMBNr (int CurrentMbNr);
 
#endif
/context_ini.h
0,0 → 1,23
 
/*!
*************************************************************************************
* \file context_ini.h
*
* \brief
* CABAC context initializations
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Detlev Marpe <marpe@hhi.de>
* - Heiko Schwarz <hschwarz@hhi.de>
**************************************************************************************
*/
 
 
#ifndef _CONTEXT_INI_
#define _CONTEXT_INI_
 
void init_contexts (struct img_par* img);
 
#endif
 
/ctx_tables.h
0,0 → 1,729
 
/*!
*************************************************************************************
* \file ctx_tables.h
*
* \brief
* CABAC context initialization tables
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Detlev Marpe <marpe@hhi.de>
* - Heiko Schwarz <hschwarz@hhi.de>
**************************************************************************************
*/
 
#define CTX_UNUSED {0,64}
#define CTX_UNDEF {0,63}
 
#ifdef CONTEXT_INI_C
 
 
#define NUM_CTX_MODELS_I 1
#define NUM_CTX_MODELS_P 3
 
 
static const int INIT_MB_TYPE_I[1][3][11][2] =
{
//----- model 0 -----
{
{ { 20, -15} , { 2, 54} , { 3, 74} , CTX_UNUSED , { -28, 127} , { -23, 104} , { -6, 53} , { -1, 54} , { 7, 51} , CTX_UNUSED , CTX_UNUSED },
{ { 20, -15} , { 2, 54} , { 3, 74} , { 20, -15} , { 2, 54} , { 3, 74} , { -28, 127} , { -23, 104} , { -6, 53} , { -1, 54} , { 7, 51} }, // SI (unused at the moment)
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
}
};
static const int INIT_MB_TYPE_P[3][3][11][2] =
{
//----- model 0 -----
{
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 23, 33} , { 23, 2} , { 21, 0} , CTX_UNUSED , { 1, 9} , { 0, 49} , { -37, 118} , { 5, 57} , { -13, 78} , { -11, 65} , { 1, 62} },
{ { 26, 67} , { 16, 90} , { 9, 104} , CTX_UNUSED , { -46, 127} , { -20, 104} , { 1, 67} , { 18, 64} , { 9, 43} , { 29, 0} , CTX_UNUSED }
},
//----- model 1 -----
{
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 22, 25} , { 34, 0} , { 16, 0} , CTX_UNUSED , { -2, 9} , { 4, 41} , { -29, 118} , { 2, 65} , { -6, 71} , { -13, 79} , { 5, 52} },
{ { 57, 2} , { 41, 36} , { 26, 69} , CTX_UNUSED , { -45, 127} , { -15, 101} , { -4, 76} , { 26, 34} , { 19, 22} , { 40, 0} , CTX_UNUSED }
},
//----- model 2 -----
{
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 29, 16} , { 25, 0} , { 14, 0} , CTX_UNUSED , { -10, 51} , { -3, 62} , { -27, 99} , { 26, 16} , { -4, 85} , { -24, 102} , { 5, 57} },
{ { 54, 0} , { 37, 42} , { 12, 97} , CTX_UNUSED , { -32, 127} , { -22, 117} , { -2, 74} , { 20, 40} , { 20, 10} , { 29, 0} , CTX_UNUSED }
}
};
 
 
 
 
 
static const int INIT_B8_TYPE_I[1][2][9][2] =
{
//----- model 0 -----
{
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
}
};
static const int INIT_B8_TYPE_P[3][2][9][2] =
{
//----- model 0 -----
{
{ CTX_UNUSED , { 12, 49} , CTX_UNUSED , { -4, 73} , { 17, 50} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -6, 86} , { -17, 95} , { -6, 61} , { 9, 45} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
},
//----- model 1 -----
{
{ CTX_UNUSED , { 9, 50} , CTX_UNUSED , { -3, 70} , { 10, 54} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 6, 69} , { -13, 90} , { 0, 52} , { 8, 43} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
},
//----- model 2 -----
{
{ CTX_UNUSED , { 6, 57} , CTX_UNUSED , { -17, 73} , { 14, 57} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -6, 93} , { -14, 88} , { -6, 44} , { 4, 55} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
}
};
 
 
 
 
 
static const int INIT_MV_RES_I[1][2][10][2] =
{
//----- model 0 -----
{
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
}
};
static const int INIT_MV_RES_P[3][2][10][2] =
{
//----- model 0 -----
{
{ { -3, 69} , CTX_UNUSED , { -6, 81} , { -11, 96} , CTX_UNUSED , { 0, 58} , CTX_UNUSED , { -3, 76} , { -10, 94} , CTX_UNUSED },
{ { 6, 55} , { 7, 67} , { -5, 86} , { 2, 88} , CTX_UNUSED , { 5, 54} , { 4, 69} , { -3, 81} , { 0, 88} , CTX_UNUSED }
},
//----- model 1 -----
{
{ { -2, 69} , CTX_UNUSED , { -5, 82} , { -10, 96} , CTX_UNUSED , { 1, 56} , CTX_UNUSED , { -3, 74} , { -6, 85} , CTX_UNUSED },
{ { 2, 59} , { 2, 75} , { -3, 87} , { -3, 100} , CTX_UNUSED , { 0, 59} , { -3, 81} , { -7, 86} , { -5, 95} , CTX_UNUSED }
},
//----- model 2 -----
{
{ { -11, 89} , CTX_UNUSED , { -15, 103} , { -21, 116} , CTX_UNUSED , { 1, 63} , CTX_UNUSED , { -5, 85} , { -13, 106} , CTX_UNUSED },
{ { 19, 57} , { 20, 58} , { 4, 84} , { 6, 96} , CTX_UNUSED , { 5, 63} , { 6, 75} , { -3, 90} , { -1, 101} , CTX_UNUSED }
}
};
 
 
 
 
 
static const int INIT_REF_NO_I[1][2][6][2] =
{
//----- model 0 -----
{
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
}
};
static const int INIT_REF_NO_P[3][2][6][2] =
{
//----- model 0 -----
{
{ { -7, 67} , { -5, 74} , { -4, 74} , { -5, 80} , { -7, 72} , { 1, 58} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
},
//----- model 1 -----
{
{ { -1, 66} , { -1, 77} , { 1, 70} , { -2, 86} , { -5, 72} , { 0, 61} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
},
//----- model 2 -----
{
{ { 3, 55} , { -4, 79} , { -2, 75} , { -12, 97} , { -7, 50} , { 1, 60} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
}
};
 
 
static const int INIT_TRANSFORM_SIZE_I[1][1][3][2]=
{
//----- model 0 -----
{
{ { 31, 21} , { 31, 31} , { 25, 50} },
// { { 0, 41} , { 0, 63} , { 0, 63} },
}
};
 
static const int INIT_TRANSFORM_SIZE_P[3][1][3][2]=
{
//----- model 0 -----
{
{ { 12, 40} , { 11, 51} , { 14, 59} },
// { { 0, 41} , { 0, 63} , { 0, 63} },
},
//----- model 1 -----
{
{ { 25, 32} , { 21, 49} , { 21, 54} },
// { { 0, 41} , { 0, 63} , { 0, 63} },
},
//----- model 2 -----
{
{ { 21, 33} , { 19, 50} , { 17, 61} },
// { { 0, 41} , { 0, 63} , { 0, 63} },
}
};
 
static const int INIT_DELTA_QP_I[1][1][4][2]=
{
//----- model 0 -----
{
{ { 0, 41} , { 0, 63} , { 0, 63} , { 0, 63} },
}
};
static const int INIT_DELTA_QP_P[3][1][4][2]=
{
//----- model 0 -----
{
{ { 0, 41} , { 0, 63} , { 0, 63} , { 0, 63} },
},
//----- model 1 -----
{
{ { 0, 41} , { 0, 63} , { 0, 63} , { 0, 63} },
},
//----- model 2 -----
{
{ { 0, 41} , { 0, 63} , { 0, 63} , { 0, 63} },
}
};
 
 
 
 
 
static const int INIT_MB_AFF_I[1][1][4][2] =
{
//----- model 0 -----
{
{ { 0, 11} , { 1, 55} , { 0, 69} , CTX_UNUSED }
}
};
static const int INIT_MB_AFF_P[3][1][4][2] =
{
//----- model 0 -----
{
{ { 0, 45} , { -4, 78} , { -3, 96} , CTX_UNUSED }
},
//----- model 1 -----
{
{ { 13, 15} , { 7, 51} , { 2, 80} , CTX_UNUSED }
},
//----- model 2 -----
{
{ { 7, 34} , { -9, 88} , { -20, 127} , CTX_UNUSED }
}
};
 
 
 
 
 
static const int INIT_IPR_I[1][1][2][2] =
{
//----- model 0 -----
{
{ { 13, 41} , { 3, 62} }
}
};
static const int INIT_IPR_P[3][1][2][2] =
{
//----- model 0 -----
{
{ { 13, 41} , { 3, 62} }
},
//----- model 1 -----
{
{ { 13, 41} , { 3, 62} }
},
//----- model 2 -----
{
{ { 13, 41} , { 3, 62} }
}
};
 
 
 
 
 
static const int INIT_CIPR_I[1][1][4][2] =
{
//----- model 0 -----
{
{ { -9, 83} , { 4, 86} , { 0, 97} , { -7, 72} }
}
};
static const int INIT_CIPR_P[3][1][4][2] =
{
//----- model 0 -----
{
{ { -9, 83} , { 4, 86} , { 0, 97} , { -7, 72} }
},
//----- model 1 -----
{
{ { -9, 83} , { 4, 86} , { 0, 97} , { -7, 72} }
},
//----- model 2 -----
{
{ { -9, 83} , { 4, 86} , { 0, 97} , { -7, 72} }
}
};
 
 
 
 
 
 
static const int INIT_CBP_I[1][3][4][2] =
{
//----- model 0 -----
{
{ { -17, 127} , { -13, 102} , { 0, 82} , { -7, 74} },
{ { -21, 107} , { -27, 127} , { -31, 127} , { -24, 127} },
{ { -18, 95} , { -27, 127} , { -21, 114} , { -30, 127} }
}
};
static const int INIT_CBP_P[3][3][4][2] =
{
//----- model 0 -----
{
{ { -27, 126} , { -28, 98} , { -25, 101} , { -23, 67} },
{ { -28, 82} , { -20, 94} , { -16, 83} , { -22, 110} },
{ { -21, 91} , { -18, 102} , { -13, 93} , { -29, 127} }
},
//----- model 1 -----
{
{ { -39, 127} , { -18, 91} , { -17, 96} , { -26, 81} },
{ { -35, 98} , { -24, 102} , { -23, 97} , { -27, 119} },
{ { -24, 99} , { -21, 110} , { -18, 102} , { -36, 127} }
},
//----- model 2 -----
{
{ { -36, 127} , { -17, 91} , { -14, 95} , { -25, 84} },
{ { -25, 86} , { -12, 89} , { -17, 91} , { -31, 127} },
{ { -14, 76} , { -18, 103} , { -13, 90} , { -37, 127} }
}
};
 
 
 
 
 
static const int INIT_BCBP_I[1][8][4][2] =
{
//----- model 0 -----
{
{ { -17, 123} , { -12, 115} , { -16, 122} , { -11, 115} },
{ { -12, 63} , { -2, 68} , { -15, 84} , { -13, 104} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -3, 70} , { -8, 93} , { -10, 90} , { -30, 127} },
{ { -1, 74} , { -6, 97} , { -7, 91} , { -20, 127} },
{ { -4, 56} , { -5, 82} , { -7, 76} , { -22, 125} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
}
};
static const int INIT_BCBP_P[3][8][4][2] =
{
//----- model 0 -----
{
{ { -7, 92} , { -5, 89} , { -7, 96} , { -13, 108} },
{ { -3, 46} , { -1, 65} , { -1, 57} , { -9, 93} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -3, 74} , { -9, 92} , { -8, 87} , { -23, 126} },
{ { 5, 54} , { 6, 60} , { 6, 59} , { 6, 69} },
{ { -1, 48} , { 0, 68} , { -4, 69} , { -8, 88} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
},
//----- model 1 -----
{
{ { 0, 80} , { -5, 89} , { -7, 94} , { -4, 92} },
{ { 0, 39} , { 0, 65} , { -15, 84} , { -35, 127} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -2, 73} , { -12, 104} , { -9, 91} , { -31, 127} },
{ { 3, 55} , { 7, 56} , { 7, 55} , { 8, 61} },
{ { -3, 53} , { 0, 68} , { -7, 74} , { -9, 88} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
},
//----- model 2 -----
{
{ { 11, 80} , { 5, 76} , { 2, 84} , { 5, 78} },
{ { -6, 55} , { 4, 61} , { -14, 83} , { -37, 127} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -5, 79} , { -11, 104} , { -11, 91} , { -30, 127} },
{ { 0, 65} , { -2, 79} , { 0, 72} , { -4, 92} },
{ { -6, 56} , { 3, 68} , { -8, 71} , { -13, 98} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
}
};
 
 
 
 
 
static const int INIT_MAP_I[1][8][15][2] =
{
//----- model 0 -----
{
{ { -7, 93} , { -11, 87} , { -3, 77} , { -5, 71} , { -4, 63} , { -4, 68} , { -12, 84} , { -7, 62} , { -7, 65} , { 8, 61} , { 5, 56} , { -2, 66} , { 1, 64} , { 0, 61} , { -2, 78} },
{ CTX_UNUSED , { 1, 50} , { 7, 52} , { 10, 35} , { 0, 44} , { 11, 38} , { 1, 45} , { 0, 46} , { 5, 44} , { 31, 17} , { 1, 51} , { 7, 50} , { 28, 19} , { 16, 33} , { 14, 62} },
{ { -17, 120} , { -20, 112} , { -18, 114} , { -11, 85} , { -15, 92} , { -14, 89} , { -26, 71} , { -15, 81} , { -14, 80} , { 0, 68} , { -14, 70} , { -24, 56} , { -23, 68} , { -24, 50} , { -11, 74} },
// { { -1, 73} , { -7, 73} , { -6, 76} , { -7, 71} , { -9, 72} , { -5, 65} , { -14, 83} , { -8, 72} , { -10, 75} , { -5, 64} , { -4, 59} , { -13, 79} , { -9, 69} , { -8, 66} , { 3, 55} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -13, 108} , { -15, 100} , { -13, 101} , { -13, 91} , { -12, 94} , { -10, 88} , { -16, 84} , { -10, 86} , { -7, 83} , { -13, 87} , { -19, 94} , { 1, 70} , { 0, 72} , { -5, 74} , { 18, 59} },
{ { -8, 102} , { -15, 100} , { 0, 95} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { -4, 75} , { 2, 72} , { -11, 75} , { -3, 71} , { 15, 46} , { -13, 69} , { 0, 62} , { 0, 65} , { 21, 37} , { -15, 72} , { 9, 57} , { 16, 54} , { 0, 62} , { 12, 72} }
}
};
static const int INIT_MAP_P[3][8][15][2] =
{
//----- model 0 -----
{
{ { -2, 85} , { -6, 78} , { -1, 75} , { -7, 77} , { 2, 54} , { 5, 50} , { -3, 68} , { 1, 50} , { 6, 42} , { -4, 81} , { 1, 63} , { -4, 70} , { 0, 67} , { 2, 57} , { -2, 76} },
{ CTX_UNUSED , { 11, 35} , { 4, 64} , { 1, 61} , { 11, 35} , { 18, 25} , { 12, 24} , { 13, 29} , { 13, 36} , { -10, 93} , { -7, 73} , { -2, 73} , { 13, 46} , { 9, 49} , { -7, 100} },
{ { -4, 79} , { -7, 71} , { -5, 69} , { -9, 70} , { -8, 66} , { -10, 68} , { -19, 73} , { -12, 69} , { -16, 70} , { -15, 67} , { -20, 62} , { -19, 70} , { -16, 66} , { -22, 65} , { -20, 63} },
// { { -4, 60} , { -3, 49} , { -2, 50} , { -4, 49} , { -5, 48} , { -2, 46} , { -7, 54} , { -1, 45} , { -4, 49} , { 4, 39} , { 0, 42} , { 2, 43} , { 0, 44} , { 5, 32} , { 15, 30} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 9, 53} , { 2, 53} , { 5, 53} , { -2, 61} , { 0, 56} , { 0, 56} , { -13, 63} , { -5, 60} , { -1, 62} , { 4, 57} , { -6, 69} , { 4, 57} , { 14, 39} , { 4, 51} , { 13, 68} },
{ { 3, 64} , { 1, 61} , { 9, 63} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 7, 50} , { 16, 39} , { 5, 44} , { 4, 52} , { 11, 48} , { -5, 60} , { -1, 59} , { 0, 59} , { 22, 33} , { 5, 44} , { 14, 43} , { -1, 78} , { 0, 60} , { 9, 69} }
},
//----- model 1 -----
{
{ { -13, 103} , { -13, 91} , { -9, 89} , { -14, 92} , { -8, 76} , { -12, 87} , { -23, 110} , { -24, 105} , { -10, 78} , { -20, 112} , { -17, 99} , { -78, 127} , { -70, 127} , { -50, 127} , { -46, 127} },
{ CTX_UNUSED , { -4, 66} , { -5, 78} , { -4, 71} , { -8, 72} , { 2, 59} , { -1, 55} , { -7, 70} , { -6, 75} , { -8, 89} , { -34, 119} , { -3, 75} , { 32, 20} , { 30, 22} , { -44, 127} },
{ { -5, 85} , { -6, 81} , { -10, 77} , { -7, 81} , { -17, 80} , { -18, 73} , { -4, 74} , { -10, 83} , { -9, 71} , { -9, 67} , { -1, 61} , { -8, 66} , { -14, 66} , { 0, 59} , { 2, 59} },
// { { -4, 60} , { -3, 49} , { -2, 50} , { -4, 49} , { -5, 48} , { -2, 46} , { -7, 54} , { -1, 45} , { -4, 49} , { 4, 39} , { 0, 42} , { 2, 43} , { 0, 44} , { 5, 32} , { 15, 30} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 0, 54} , { -5, 61} , { 0, 58} , { -1, 60} , { -3, 61} , { -8, 67} , { -25, 84} , { -14, 74} , { -5, 65} , { 5, 52} , { 2, 57} , { 0, 61} , { -9, 69} , { -11, 70} , { 18, 55} },
{ { -4, 71} , { 0, 58} , { 7, 61} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 9, 41} , { 18, 25} , { 9, 32} , { 5, 43} , { 9, 47} , { 0, 44} , { 0, 51} , { 2, 46} , { 19, 38} , { -4, 66} , { 15, 38} , { 12, 42} , { 9, 34} , { 0, 89} }
},
//----- model 2 -----
{
{ { -4, 86} , { -12, 88} , { -5, 82} , { -3, 72} , { -4, 67} , { -8, 72} , { -16, 89} , { -9, 69} , { -1, 59} , { 5, 66} , { 4, 57} , { -4, 71} , { -2, 71} , { 2, 58} , { -1, 74} },
{ CTX_UNUSED , { -4, 44} , { -1, 69} , { 0, 62} , { -7, 51} , { -4, 47} , { -6, 42} , { -3, 41} , { -6, 53} , { 8, 76} , { -9, 78} , { -11, 83} , { 9, 52} , { 0, 67} , { -5, 90} },
{ { -3, 78} , { -8, 74} , { -9, 72} , { -10, 72} , { -18, 75} , { -12, 71} , { -11, 63} , { -5, 70} , { -17, 75} , { -14, 72} , { -16, 67} , { -8, 53} , { -14, 59} , { -9, 52} , { -11, 68} },
// { { -4, 60} , { -3, 49} , { -2, 50} , { -4, 49} , { -5, 48} , { -2, 46} , { -7, 54} , { -1, 45} , { -4, 49} , { 4, 39} , { 0, 42} , { 2, 43} , { 0, 44} , { 5, 32} , { 15, 30} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 1, 67} , { -15, 72} , { -5, 75} , { -8, 80} , { -21, 83} , { -21, 64} , { -13, 31} , { -25, 64} , { -29, 94} , { 9, 75} , { 17, 63} , { -8, 74} , { -5, 35} , { -2, 27} , { 13, 91} },
{ { 3, 65} , { -7, 69} , { 8, 77} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { -10, 66} , { 3, 62} , { -3, 68} , { -20, 81} , { 0, 30} , { 1, 7} , { -3, 23} , { -21, 74} , { 16, 66} , { -23, 124} , { 17, 37} , { 44, -18} , { 50, -34} , { -22, 127} }
}
};
 
 
 
 
static const int INIT_LAST_I[1][8][15][2] =
{
//----- model 0 -----
{
{ { 24, 0} , { 15, 9} , { 8, 25} , { 13, 18} , { 15, 9} , { 13, 19} , { 10, 37} , { 12, 18} , { 6, 29} , { 20, 33} , { 15, 30} , { 4, 45} , { 1, 58} , { 0, 62} , { 7, 61} },
{ CTX_UNUSED , { 12, 38} , { 11, 45} , { 15, 39} , { 11, 42} , { 13, 44} , { 16, 45} , { 12, 41} , { 10, 49} , { 30, 34} , { 18, 42} , { 10, 55} , { 17, 51} , { 17, 46} , { 0, 89} },
{ { 23, -13} , { 26, -13} , { 40, -15} , { 49, -14} , { 44, 3} , { 45, 6} , { 44, 34} , { 33, 54} , { 19, 82} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
// { { 12, 33} , { 5, 38} , { 9, 34} , { 18, 22} , { 19, 22} , { 23, 19} , { 26, 16} , { 14, 44} , { 40, 14} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 26, -19} , { 22, -17} , { 26, -17} , { 30, -25} , { 28, -20} , { 33, -23} , { 37, -27} , { 33, -23} , { 40, -28} , { 38, -17} , { 33, -11} , { 40, -15} , { 41, -6} , { 38, 1} , { 41, 17} },
{ { 30, -6} , { 27, 3} , { 26, 22} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 37, -16} , { 35, -4} , { 38, -8} , { 38, -3} , { 37, 3} , { 38, 5} , { 42, 0} , { 35, 16} , { 39, 22} , { 14, 48} , { 27, 37} , { 21, 60} , { 12, 68} , { 2, 97} }
}
};
static const int INIT_LAST_P[3][8][15][2] =
{
//----- model 0 -----
{
{ { 11, 28} , { 2, 40} , { 3, 44} , { 0, 49} , { 0, 46} , { 2, 44} , { 2, 51} , { 0, 47} , { 4, 39} , { 2, 62} , { 6, 46} , { 0, 54} , { 3, 54} , { 2, 58} , { 4, 63} },
{ CTX_UNUSED , { 6, 51} , { 6, 57} , { 7, 53} , { 6, 52} , { 6, 55} , { 11, 45} , { 14, 36} , { 8, 53} , { -1, 82} , { 7, 55} , { -3, 78} , { 15, 46} , { 22, 31} , { -1, 84} },
{ { 9, -2} , { 26, -9} , { 33, -9} , { 39, -7} , { 41, -2} , { 45, 3} , { 49, 9} , { 45, 27} , { 36, 59} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
// { { 17, 27} , { 23, 13} , { 24, 16} , { 22, 25} , { 23, 27} , { 23, 32} , { 17, 43} , { 17, 49} , { 2, 70} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 25, 7} , { 30, -7} , { 28, 3} , { 28, 4} , { 32, 0} , { 34, -1} , { 30, 6} , { 30, 6} , { 32, 9} , { 31, 19} , { 26, 27} , { 26, 30} , { 37, 20} , { 28, 34} , { 17, 70} },
{ { 1, 67} , { 5, 59} , { 9, 67} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 16, 30} , { 18, 32} , { 18, 35} , { 22, 29} , { 24, 31} , { 23, 38} , { 18, 43} , { 20, 41} , { 11, 63} , { 9, 59} , { 9, 64} , { -1, 94} , { -2, 89} , { -9, 108} }
},
//----- model 1 -----
{
{ { 4, 45} , { 10, 28} , { 10, 31} , { 33, -11} , { 52, -43} , { 18, 15} , { 28, 0} , { 35, -22} , { 38, -25} , { 34, 0} , { 39, -18} , { 32, -12} , { 102, -94} , { 0, 0} , { 56, -15} },
{ CTX_UNUSED , { 33, -4} , { 29, 10} , { 37, -5} , { 51, -29} , { 39, -9} , { 52, -34} , { 69, -58} , { 67, -63} , { 44, -5} , { 32, 7} , { 55, -29} , { 32, 1} , { 0, 0} , { 27, 36} },
{ { 17, -10} , { 32, -13} , { 42, -9} , { 49, -5} , { 53, 0} , { 64, 3} , { 68, 10} , { 66, 27} , { 47, 57} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
// { { 17, 27} , { 23, 13} , { 24, 16} , { 22, 25} , { 23, 27} , { 23, 32} , { 17, 43} , { 17, 49} , { 2, 70} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 33, -25} , { 34, -30} , { 36, -28} , { 38, -28} , { 38, -27} , { 34, -18} , { 35, -16} , { 34, -14} , { 32, -8} , { 37, -6} , { 35, 0} , { 30, 10} , { 28, 18} , { 26, 25} , { 29, 41} },
{ { 0, 75} , { 2, 72} , { 8, 77} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 14, 35} , { 18, 31} , { 17, 35} , { 21, 30} , { 17, 45} , { 20, 42} , { 18, 45} , { 27, 26} , { 16, 54} , { 7, 66} , { 16, 56} , { 11, 73} , { 10, 67} , { -10, 116} }
},
//----- model 2 -----
{
{ { 4, 39} , { 0, 42} , { 7, 34} , { 11, 29} , { 8, 31} , { 6, 37} , { 7, 42} , { 3, 40} , { 8, 33} , { 13, 43} , { 13, 36} , { 4, 47} , { 3, 55} , { 2, 58} , { 6, 60} },
{ CTX_UNUSED , { 8, 44} , { 11, 44} , { 14, 42} , { 7, 48} , { 4, 56} , { 4, 52} , { 13, 37} , { 9, 49} , { 19, 58} , { 10, 48} , { 12, 45} , { 0, 69} , { 20, 33} , { 8, 63} },
{ { 9, -2} , { 30, -10} , { 31, -4} , { 33, -1} , { 33, 7} , { 31, 12} , { 37, 23} , { 31, 38} , { 20, 64} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
// { { 17, 27} , { 23, 13} , { 24, 16} , { 22, 25} , { 23, 27} , { 23, 32} , { 17, 43} , { 17, 49} , { 2, 70} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 35, -18} , { 33, -25} , { 28, -3} , { 24, 10} , { 27, 0} , { 34, -14} , { 52, -44} , { 39, -24} , { 19, 17} , { 31, 25} , { 36, 29} , { 24, 33} , { 34, 15} , { 30, 20} , { 22, 73} },
{ { 20, 34} , { 19, 31} , { 27, 44} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 19, 16} , { 15, 36} , { 15, 36} , { 21, 28} , { 25, 21} , { 30, 20} , { 31, 12} , { 27, 16} , { 24, 42} , { 0, 93} , { 14, 56} , { 15, 57} , { 26, 38} , { -24, 127} }
}
};
 
 
 
 
 
static const int INIT_ONE_I[1][8][5][2] =
{
//----- model 0 -----
{
{ { -3, 71} , { -6, 42} , { -5, 50} , { -3, 54} , { -2, 62} },
{ { -5, 67} , { -5, 27} , { -3, 39} , { -2, 44} , { 0, 46} },
{ { -3, 75} , { -1, 23} , { 1, 34} , { 1, 43} , { 0, 54} },
// { { -9, 75} , { -1, 44} , { -2, 49} , { -2, 51} , { -1, 51} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -12, 92} , { -15, 55} , { -10, 60} , { -6, 62} , { -4, 65} },
{ { -11, 97} , { -20, 84} , { -11, 79} , { -6, 73} , { -4, 74} },
{ { -8, 78} , { -5, 33} , { -4, 48} , { -2, 53} , { -3, 62} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
}
};
static const int INIT_ONE_P[3][8][5][2] =
{
//----- model 0 -----
{
{ { -6, 76} , { -2, 44} , { 0, 45} , { 0, 52} , { -3, 64} },
{ { -9, 77} , { 3, 24} , { 0, 42} , { 0, 48} , { 0, 55} },
{ { -6, 66} , { -7, 35} , { -7, 42} , { -8, 45} , { -5, 48} },
// { { -3, 58} , { -1, 28} , { 0, 29} , { 2, 30} , { 1, 35} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 1, 58} , { -3, 29} , { -1, 36} , { 1, 38} , { 2, 43} },
{ { 0, 70} , { -4, 29} , { 5, 31} , { 7, 42} , { 1, 59} },
{ { 0, 58} , { 8, 5} , { 10, 14} , { 14, 18} , { 13, 27} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
},
//----- model 1 -----
{
{ { -23, 112} , { -15, 71} , { -7, 61} , { 0, 53} , { -5, 66} },
{ { -21, 101} , { -3, 39} , { -5, 53} , { -7, 61} , { -11, 75} },
{ { -5, 71} , { 0, 24} , { -1, 36} , { -2, 42} , { -2, 52} },
// { { -3, 58} , { -1, 28} , { 0, 29} , { 2, 30} , { 1, 35} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -11, 76} , { -10, 44} , { -10, 52} , { -10, 57} , { -9, 58} },
{ { 2, 66} , { -9, 34} , { 1, 32} , { 11, 31} , { 5, 52} },
{ { 3, 52} , { 7, 4} , { 10, 8} , { 17, 8} , { 16, 19} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
},
//----- model 2 -----
{
{ { -24, 115} , { -22, 82} , { -9, 62} , { 0, 53} , { 0, 59} },
{ { -21, 100} , { -14, 57} , { -12, 67} , { -11, 71} , { -10, 77} },
{ { -9, 71} , { -7, 37} , { -8, 44} , { -11, 49} , { -10, 56} },
// { { -3, 58} , { -1, 28} , { 0, 29} , { 2, 30} , { 1, 35} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -10, 82} , { -8, 48} , { -8, 61} , { -8, 66} , { -7, 70} },
{ { -4, 79} , { -22, 69} , { -16, 75} , { -2, 58} , { 1, 58} },
{ { -13, 81} , { -6, 38} , { -13, 62} , { -6, 58} , { -2, 59} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
}
};
 
 
 
 
 
static const int INIT_ABS_I[1][8][5][2] =
{
//----- model 0 -----
{
{ { 0, 58} , { 1, 63} , { -2, 72} , { -1, 74} , { -9, 91} },
{ { -16, 64} , { -8, 68} , { -10, 78} , { -6, 77} , { -10, 86} },
{ { -2, 55} , { 0, 61} , { 1, 64} , { 0, 68} , { -9, 92} },
// { { -4, 56} , { -1, 59} , { -6, 71} , { -8, 74} , { -11, 85} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -12, 73} , { -8, 76} , { -7, 80} , { -9, 88} , { -17, 110} },
{ { -13, 86} , { -13, 96} , { -11, 97} , { -19, 117} , CTX_UNUSED },
{ { -13, 71} , { -10, 79} , { -12, 86} , { -13, 90} , { -14, 97} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
}
};
static const int INIT_ABS_P[3][8][5][2] =
{
//----- model 0 -----
{
{ { -2, 59} , { -4, 70} , { -4, 75} , { -8, 82} , { -17, 102} },
{ { -6, 59} , { -7, 71} , { -12, 83} , { -11, 87} , { -30, 119} },
{ { -12, 56} , { -6, 60} , { -5, 62} , { -8, 66} , { -8, 76} },
// { { -7, 54} , { -2, 58} , { -4, 63} , { -5, 66} , { 1, 64} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -6, 55} , { 0, 58} , { 0, 64} , { -3, 74} , { -10, 90} },
{ { -2, 58} , { -3, 72} , { -3, 81} , { -11, 97} , CTX_UNUSED },
{ { 2, 40} , { 0, 58} , { -3, 70} , { -6, 79} , { -8, 85} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
},
//----- model 1 -----
{
{ { -11, 77} , { -9, 80} , { -9, 84} , { -10, 87} , { -34, 127} },
{ { -15, 77} , { -17, 91} , { -25, 107} , { -25, 111} , { -28, 122} },
{ { -9, 57} , { -6, 63} , { -4, 65} , { -4, 67} , { -7, 82} },
// { { -7, 54} , { -2, 58} , { -4, 63} , { -5, 66} , { 1, 64} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -16, 72} , { -7, 69} , { -4, 69} , { -5, 74} , { -9, 86} },
{ { -2, 55} , { -2, 67} , { 0, 73} , { -8, 89} , CTX_UNUSED },
{ { 3, 37} , { -1, 61} , { -5, 73} , { -1, 70} , { -4, 78} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
},
//----- model 2 -----
{
{ { -14, 85} , { -13, 89} , { -13, 94} , { -11, 92} , { -29, 127} },
{ { -21, 85} , { -16, 88} , { -23, 104} , { -15, 98} , { -37, 127} },
{ { -12, 59} , { -8, 63} , { -9, 67} , { -6, 68} , { -10, 79} },
// { { -7, 54} , { -2, 58} , { -4, 63} , { -5, 66} , { 1, 64} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -14, 75} , { -10, 79} , { -9, 83} , { -12, 92} , { -18, 108} },
{ { -13, 78} , { -9, 83} , { -4, 81} , { -13, 99} , CTX_UNUSED },
{ { -16, 73} , { -10, 76} , { -13, 86} , { -9, 83} , { -10, 87} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED }
}
};
 
 
 
 
 
static const int INIT_FLD_MAP_I[1][8][15][2] =
{
//----- model 0 -----
{
{ { -6, 93} , { -6, 84} , { -8, 79} , { 0, 66} , { -1, 71} , { 0, 62} , { -2, 60} , { -2, 59} , { -5, 75} , { -3, 62} , { -4, 58} , { -9, 66} , { -1, 79} , { 0, 71} , { 3, 68} },
{ CTX_UNUSED , { 10, 44} , { -7, 62} , { 15, 36} , { 14, 40} , { 16, 27} , { 12, 29} , { 1, 44} , { 20, 36} , { 18, 32} , { 5, 42} , { 1, 48} , { 10, 62} , { 17, 46} , { 9, 64} },
{ { -14, 106} , { -13, 97} , { -15, 90} , { -12, 90} , { -18, 88} , { -10, 73} , { -9, 79} , { -14, 86} , { -10, 73} , { -10, 70} , { -10, 69} , { -5, 66} , { -9, 64} , { -5, 58} , { 2, 59} },
// { { -1, 73} , { -7, 73} , { -6, 76} , { -7, 71} , { -9, 72} , { -5, 65} , { -14, 83} , { -8, 72} , { -10, 75} , { -5, 64} , { -4, 59} , { -13, 79} , { -9, 69} , { -8, 66} , { 3, 55} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -12, 104} , { -11, 97} , { -16, 96} , { -7, 88} , { -8, 85} , { -7, 85} , { -9, 85} , { -13, 88} , { 4, 66} , { -3, 77} , { -3, 76} , { -6, 76} , { 10, 58} , { -1, 76} , { -1, 83} },
{ { -7, 99} , { -14, 95} , { 2, 95} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 0, 76} , { -5, 74} , { 0, 70} , { -11, 75} , { 1, 68} , { 0, 65} , { -14, 73} , { 3, 62} , { 4, 62} , { -1, 68} , { -13, 75} , { 11, 55} , { 5, 64} , { 12, 70} }
}
};
static const int INIT_FLD_MAP_P[3][8][15][2] =
{
//----- model 0 -----
{
{ { -13, 106} , { -16, 106} , { -10, 87} , { -21, 114} , { -18, 110} , { -14, 98} , { -22, 110} , { -21, 106} , { -18, 103} , { -21, 107} , { -23, 108} , { -26, 112} , { -10, 96} , { -12, 95} , { -5, 91} },
{ CTX_UNUSED , { -9, 93} , { -22, 94} , { -5, 86} , { 9, 67} , { -4, 80} , { -10, 85} , { -1, 70} , { 7, 60} , { 9, 58} , { 5, 61} , { 12, 50} , { 15, 50} , { 18, 49} , { 17, 54} },
{ { -5, 85} , { -6, 81} , { -10, 77} , { -7, 81} , { -17, 80} , { -18, 73} , { -4, 74} , { -10, 83} , { -9, 71} , { -9, 67} , { -1, 61} , { -8, 66} , { -14, 66} , { 0, 59} , { 2, 59} },
// { { -4, 60} , { -3, 49} , { -2, 50} , { -4, 49} , { -5, 48} , { -2, 46} , { -7, 54} , { -1, 45} , { -4, 49} , { 4, 39} , { 0, 42} , { 2, 43} , { 0, 44} , { 5, 32} , { 15, 30} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 10, 41} , { 7, 46} , { -1, 51} , { 7, 49} , { 8, 52} , { 9, 41} , { 6, 47} , { 2, 55} , { 13, 41} , { 10, 44} , { 6, 50} , { 5, 53} , { 13, 49} , { 4, 63} , { 6, 64} },
{ { -2, 69} , { -2, 59} , { 6, 70} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 10, 44} , { 9, 31} , { 12, 43} , { 3, 53} , { 14, 34} , { 10, 38} , { -3, 52} , { 13, 40} , { 17, 32} , { 7, 44} , { 7, 38} , { 13, 50} , { 10, 57} , { 26, 43} }
},
//----- model 1 -----
{
{ { -21, 126} , { -23, 124} , { -20, 110} , { -26, 126} , { -25, 124} , { -17, 105} , { -27, 121} , { -27, 117} , { -17, 102} , { -26, 117} , { -27, 116} , { -33, 122} , { -10, 95} , { -14, 100} , { -8, 95} },
{ CTX_UNUSED , { -17, 111} , { -28, 114} , { -6, 89} , { -2, 80} , { -4, 82} , { -9, 85} , { -8, 81} , { -1, 72} , { 5, 64} , { 1, 67} , { 9, 56} , { 0, 69} , { 1, 69} , { 7, 69} },
{ { -3, 81} , { -3, 76} , { -7, 72} , { -6, 78} , { -12, 72} , { -14, 68} , { -3, 70} , { -6, 76} , { -5, 66} , { -5, 62} , { 0, 57} , { -4, 61} , { -9, 60} , { 1, 54} , { 2, 58} },
// { { -4, 60} , { -3, 49} , { -2, 50} , { -4, 49} , { -5, 48} , { -2, 46} , { -7, 54} , { -1, 45} , { -4, 49} , { 4, 39} , { 0, 42} , { 2, 43} , { 0, 44} , { 5, 32} , { 15, 30} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { -7, 69} , { -6, 67} , { -16, 77} , { -2, 64} , { 2, 61} , { -6, 67} , { -3, 64} , { 2, 57} , { -3, 65} , { -3, 66} , { 0, 62} , { 9, 51} , { -1, 66} , { -2, 71} , { -2, 75} },
{ { -1, 70} , { -9, 72} , { 14, 60} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 16, 37} , { 0, 47} , { 18, 35} , { 11, 37} , { 12, 41} , { 10, 41} , { 2, 48} , { 12, 41} , { 13, 41} , { 0, 59} , { 3, 50} , { 19, 40} , { 3, 66} , { 18, 50} }
},
//----- model 2 -----
{
{ { -22, 127} , { -25, 127} , { -25, 120} , { -27, 127} , { -19, 114} , { -23, 117} , { -25, 118} , { -26, 117} , { -24, 113} , { -28, 118} , { -31, 120} , { -37, 124} , { -10, 94} , { -15, 102} , { -10, 99} },
{ CTX_UNUSED , { -13, 106} , { -50, 127} , { -5, 92} , { 17, 57} , { -5, 86} , { -13, 94} , { -12, 91} , { -2, 77} , { 0, 71} , { -1, 73} , { 4, 64} , { -7, 81} , { 5, 64} , { 15, 57} },
{ { -3, 78} , { -8, 74} , { -9, 72} , { -10, 72} , { -18, 75} , { -12, 71} , { -11, 63} , { -5, 70} , { -17, 75} , { -14, 72} , { -16, 67} , { -8, 53} , { -14, 59} , { -9, 52} , { -11, 68} },
// { { -4, 60} , { -3, 49} , { -2, 50} , { -4, 49} , { -5, 48} , { -2, 46} , { -7, 54} , { -1, 45} , { -4, 49} , { 4, 39} , { 0, 42} , { 2, 43} , { 0, 44} , { 5, 32} , { 15, 30} },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 1, 67} , { 0, 68} , { -10, 67} , { 1, 68} , { 0, 77} , { 2, 64} , { 0, 68} , { -5, 78} , { 7, 55} , { 5, 59} , { 2, 65} , { 14, 54} , { 15, 44} , { 5, 60} , { 2, 70} },
{ { -2, 76} , { -18, 86} , { 12, 70} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 5, 64} , { -12, 70} , { 11, 55} , { 5, 56} , { 0, 69} , { 2, 65} , { -6, 74} , { 5, 54} , { 7, 54} , { -6, 76} , { -11, 82} , { -2, 77} , { -2, 77} , { 25, 42} }
}
};
 
 
 
 
 
static const int INIT_FLD_LAST_I[1][8][15][2] =
{
//----- model 0 -----
{
{ { 15, 6} , { 6, 19} , { 7, 16} , { 12, 14} , { 18, 13} , { 13, 11} , { 13, 15} , { 15, 16} , { 12, 23} , { 13, 23} , { 15, 20} , { 14, 26} , { 14, 44} , { 17, 40} , { 17, 47} },
{ CTX_UNUSED , { 24, 17} , { 21, 21} , { 25, 22} , { 31, 27} , { 22, 29} , { 19, 35} , { 14, 50} , { 10, 57} , { 7, 63} , { -2, 77} , { -4, 82} , { -3, 94} , { 9, 69} , { -12, 109} },
{ { 21, -10} , { 24, -11} , { 28, -8} , { 28, -1} , { 29, 3} , { 29, 9} , { 35, 20} , { 29, 36} , { 14, 67} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
// { { 12, 33} , { 5, 38} , { 9, 34} , { 18, 22} , { 19, 22} , { 23, 19} , { 26, 16} , { 14, 44} , { 40, 14} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 36, -35} , { 36, -34} , { 32, -26} , { 37, -30} , { 44, -32} , { 34, -18} , { 34, -15} , { 40, -15} , { 33, -7} , { 35, -5} , { 33, 0} , { 38, 2} , { 33, 13} , { 23, 35} , { 13, 58} },
{ { 29, -3} , { 26, 0} , { 22, 30} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 31, -7} , { 35, -15} , { 34, -3} , { 34, 3} , { 36, -1} , { 34, 5} , { 32, 11} , { 35, 5} , { 34, 12} , { 39, 11} , { 30, 29} , { 34, 26} , { 29, 39} , { 19, 66} }
}
};
static const int INIT_FLD_LAST_P[3][8][15][2] =
{
//----- model 0 -----
{
{ { 14, 11} , { 11, 14} , { 9, 11} , { 18, 11} , { 21, 9} , { 23, -2} , { 32, -15} , { 32, -15} , { 34, -21} , { 39, -23} , { 42, -33} , { 41, -31} , { 46, -28} , { 38, -12} , { 21, 29} },
{ CTX_UNUSED , { 45, -24} , { 53, -45} , { 48, -26} , { 65, -43} , { 43, -19} , { 39, -10} , { 30, 9} , { 18, 26} , { 20, 27} , { 0, 57} , { -14, 82} , { -5, 75} , { -19, 97} , { -35, 125} },
{ { 21, -13} , { 33, -14} , { 39, -7} , { 46, -2} , { 51, 2} , { 60, 6} , { 61, 17} , { 55, 34} , { 42, 62} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
// { { 17, 27} , { 23, 13} , { 24, 16} , { 22, 25} , { 23, 27} , { 23, 32} , { 17, 43} , { 17, 49} , { 2, 70} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 27, 0} , { 28, 0} , { 31, -4} , { 27, 6} , { 34, 8} , { 30, 10} , { 24, 22} , { 33, 19} , { 22, 32} , { 26, 31} , { 21, 41} , { 26, 44} , { 23, 47} , { 16, 65} , { 14, 71} },
{ { 8, 60} , { 6, 63} , { 17, 65} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 21, 24} , { 23, 20} , { 26, 23} , { 27, 32} , { 28, 23} , { 28, 24} , { 23, 40} , { 24, 32} , { 28, 29} , { 23, 42} , { 19, 57} , { 22, 53} , { 22, 61} , { 11, 86} }
},
//----- model 1 -----
{
{ { 19, -6} , { 18, -6} , { 14, 0} , { 26, -12} , { 31, -16} , { 33, -25} , { 33, -22} , { 37, -28} , { 39, -30} , { 42, -30} , { 47, -42} , { 45, -36} , { 49, -34} , { 41, -17} , { 32, 9} },
{ CTX_UNUSED , { 69, -71} , { 63, -63} , { 66, -64} , { 77, -74} , { 54, -39} , { 52, -35} , { 41, -10} , { 36, 0} , { 40, -1} , { 30, 14} , { 28, 26} , { 23, 37} , { 12, 55} , { 11, 65} },
{ { 17, -10} , { 32, -13} , { 42, -9} , { 49, -5} , { 53, 0} , { 64, 3} , { 68, 10} , { 66, 27} , { 47, 57} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
// { { 17, 27} , { 23, 13} , { 24, 16} , { 22, 25} , { 23, 27} , { 23, 32} , { 17, 43} , { 17, 49} , { 2, 70} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 37, -33} , { 39, -36} , { 40, -37} , { 38, -30} , { 46, -33} , { 42, -30} , { 40, -24} , { 49, -29} , { 38, -12} , { 40, -10} , { 38, -3} , { 46, -5} , { 31, 20} , { 29, 30} , { 25, 44} },
{ { 12, 48} , { 11, 49} , { 26, 45} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 22, 22} , { 23, 22} , { 27, 21} , { 33, 20} , { 26, 28} , { 30, 24} , { 27, 34} , { 18, 42} , { 25, 39} , { 18, 50} , { 12, 70} , { 21, 54} , { 14, 71} , { 11, 83} }
},
//----- model 2 -----
{
{ { 17, -13} , { 16, -9} , { 17, -12} , { 27, -21} , { 37, -30} , { 41, -40} , { 42, -41} , { 48, -47} , { 39, -32} , { 46, -40} , { 52, -51} , { 46, -41} , { 52, -39} , { 43, -19} , { 32, 11} },
{ CTX_UNUSED , { 61, -55} , { 56, -46} , { 62, -50} , { 81, -67} , { 45, -20} , { 35, -2} , { 28, 15} , { 34, 1} , { 39, 1} , { 30, 17} , { 20, 38} , { 18, 45} , { 15, 54} , { 0, 79} },
{ { 9, -2} , { 30, -10} , { 31, -4} , { 33, -1} , { 33, 7} , { 31, 12} , { 37, 23} , { 31, 38} , { 20, 64} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
// { { 17, 27} , { 23, 13} , { 24, 16} , { 22, 25} , { 23, 27} , { 23, 32} , { 17, 43} , { 17, 49} , { 2, 70} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ { 36, -16} , { 37, -14} , { 37, -17} , { 32, 1} , { 34, 15} , { 29, 15} , { 24, 25} , { 34, 22} , { 31, 16} , { 35, 18} , { 31, 28} , { 33, 41} , { 36, 28} , { 27, 47} , { 21, 62} },
{ { 18, 31} , { 19, 26} , { 36, 24} , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED , CTX_UNUSED },
{ CTX_UNUSED , { 24, 23} , { 27, 16} , { 24, 30} , { 31, 29} , { 22, 41} , { 22, 42} , { 16, 60} , { 15, 52} , { 14, 60} , { 3, 78} , { -16, 123} , { 21, 53} , { 22, 56} , { 25, 61} }
}
};
 
 
#endif
 
/header.h
0,0 → 1,23
 
/*!
*************************************************************************************
* \file header.h
*
* \brief
* Prototypes for header.c
*************************************************************************************
*/
 
#ifndef _HEADER_H_
#define _HEADER_H_
 
int FirstPartOfSliceHeader();
int RestOfSliceHeader();
 
void dec_ref_pic_marking(Bitstream *currStream);
 
void decode_poc(struct img_par *img);
int dumppoc(struct img_par *img);
 
#endif
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.