Initial community commit

This commit is contained in:
Jef
2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit 20d28e80a5
16810 changed files with 4640254 additions and 2 deletions

View File

@ -0,0 +1,157 @@
/*!
***************************************************************************
* \file
* biaridecod.h
*
* \brief
* Headerfile for binary arithmetic decoder routines
*
* \author
* Detlev Marpe,
* Gabi Bl<42>ttermann
* 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
***********************************************************************
*/
/* Range table for LPS */
/*
static const byte rLPS_table_64x4[64][4]=
{
{ 128, 176, 208, 240},
{ 128, 167, 197, 227},
{ 128, 158, 187, 216},
{ 123, 150, 178, 205},
{ 116, 142, 169, 195},
{ 111, 135, 160, 185},
{ 105, 128, 152, 175},
{ 100, 122, 144, 166},
{ 95, 116, 137, 158},
{ 90, 110, 130, 150},
{ 85, 104, 123, 142},
{ 81, 99, 117, 135},
{ 77, 94, 111, 128},
{ 73, 89, 105, 122},
{ 69, 85, 100, 116},
{ 66, 80, 95, 110},
{ 62, 76, 90, 104},
{ 59, 72, 86, 99},
{ 56, 69, 81, 94},
{ 53, 65, 77, 89},
{ 51, 62, 73, 85},
{ 48, 59, 69, 80},
{ 46, 56, 66, 76},
{ 43, 53, 63, 72},
{ 41, 50, 59, 69},
{ 39, 48, 56, 65},
{ 37, 45, 54, 62},
{ 35, 43, 51, 59},
{ 33, 41, 48, 56},
{ 32, 39, 46, 53},
{ 30, 37, 43, 50},
{ 29, 35, 41, 48},
{ 27, 33, 39, 45},
{ 26, 31, 37, 43},
{ 24, 30, 35, 41},
{ 23, 28, 33, 39},
{ 22, 27, 32, 37},
{ 21, 26, 30, 35},
{ 20, 24, 29, 33},
{ 19, 23, 27, 31},
{ 18, 22, 26, 30},
{ 17, 21, 25, 28},
{ 16, 20, 23, 27},
{ 15, 19, 22, 25},
{ 14, 18, 21, 24},
{ 14, 17, 20, 23},
{ 13, 16, 19, 22},
{ 12, 15, 18, 21},
{ 12, 14, 17, 20},
{ 11, 14, 16, 19},
{ 11, 13, 15, 18},
{ 10, 12, 15, 17},
{ 10, 12, 14, 16},
{ 9, 11, 13, 15},
{ 9, 11, 12, 14},
{ 8, 10, 12, 14},
{ 8, 9, 11, 13},
{ 7, 9, 11, 12},
{ 7, 9, 10, 12},
{ 7, 8, 10, 11},
{ 6, 8, 9, 11},
{ 6, 7, 9, 10},
{ 6, 7, 8, 9},
{ 2, 2, 2, 2}
};*/
static const byte rLPS_table_64x4[4][64]={
{128, 128, 128, 123, 116, 111, 105, 100, 95, 90, 85, 81, 77, 73, 69, 66,
62, 59, 56, 53, 51, 48, 46, 43, 41, 39, 37, 35, 33, 32, 30, 29,
27, 26, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 14, 13, 12,
12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 7, 6, 6, 6, 2,
},
{176, 167, 158, 150, 142, 135, 128, 122, 116, 110, 104, 99, 94, 89, 85, 80,
76, 72, 69, 65, 62, 59, 56, 53, 50, 48, 45, 43, 41, 39, 37, 35,
33, 31, 30, 28, 27, 26, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15,
14, 14, 13, 12, 12, 11, 11, 10, 9, 9, 9, 8, 8, 7, 7, 2,
},
{208, 197, 187, 178, 169, 160, 152, 144, 137, 130, 123, 117, 111, 105, 100, 95,
90, 86, 81, 77, 73, 69, 66, 63, 59, 56, 54, 51, 48, 46, 43, 41,
39, 37, 35, 33, 32, 30, 29, 27, 26, 25, 23, 22, 21, 20, 19, 18,
17, 16, 15, 15, 14, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 2,
},
{240, 227, 216, 205, 195, 185, 175, 166, 158, 150, 142, 135, 128, 122, 116, 110,
104, 99, 94, 89, 85, 80, 76, 72, 69, 65, 62, 59, 56, 53, 50, 48,
45, 43, 41, 39, 37, 35, 33, 31, 30, 28, 27, 25, 24, 23, 22, 21,
20, 19, 18, 17, 16, 15, 14, 14, 13, 12, 12, 11, 11, 10, 9, 2,
}};
// make uint16 to match biari_decode_symbol
static const byte AC_next_state_MPS_64[64] =
{
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,30,
31,32,33,34,35,36,37,38,39,40,
41,42,43,44,45,46,47,48,49,50,
51,52,53,54,55,56,57,58,59,60,
61,62,62,63
};
// make uint16 to match biari_decode_symbol
static const byte AC_next_state_LPS_64[64] =
{
0, 0, 1, 2, 2, 4, 4, 5, 6, 7,
8, 9, 9,11,11,12,13,13,15,15,
16,16,18,18,19,19,21,21,22,22,
23,24,24,25,26,26,27,27,28,29,
29,30,30,30,31,32,32,33,33,33,
34,34,35,35,35,36,36,36,37,37,
37,38,38,63
};
static const byte renorm_table_32[32]={6,5,4,4,3,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
static const byte renorm_table_256[256]={6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, };
extern void arideco_start_decoding(DecodingEnvironmentPtr eep, unsigned char *code_buffer, int firstbyte, int *code_len);
//extern int arideco_bits_read(const DecodingEnvironmentPtr dep);
extern void arideco_done_decoding(DecodingEnvironmentPtr dep);
extern void biari_init_context (int qp, BiContextTypePtr ctx, const char* ini);
extern unsigned int biari_decode_symbol(DecodingEnvironmentPtr dep, BiContextTypePtr bi_ct );
extern unsigned int biari_decode_symbol_eq_prob(DecodingEnvironmentPtr dep);
extern unsigned int biari_decode_final(DecodingEnvironmentPtr dep);
extern unsigned int getbyte(DecodingEnvironmentPtr dep);
extern unsigned int getword(DecodingEnvironmentPtr dep);
#endif // BIARIDECOD_H_

View File

@ -0,0 +1,133 @@
/*!
************************************************************************
* \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"
#include "transform8x8.h"
static 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
};
//! look up tables for FRExt_chroma support
static 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}
}
};
static 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 const byte decode_block_scan[16] = {0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15};
static const int cof4_pos_to_subblock[4][4] = { { 0, 1, 4, 5}, {2,3,6,7}, {8,9,12,13}, {10,11,14,15} };
extern void iMBtrans4x4(Macroblock *currMB, ColorPlane pl, int smb);
extern void iMBtrans8x8(Macroblock *currMB, ColorPlane pl);
extern void itrans_sp_cr(Macroblock *currMB, int uv);
extern void intrapred_chroma (Macroblock *currMB, int uv);
extern void Inv_Residual_trans_4x4(Macroblock *currMB, ColorPlane pl, int ioff, int joff);
extern void Inv_Residual_trans_8x8(Macroblock *currMB, ColorPlane pl, int ioff,int joff);
extern void itrans4x4_c(const h264_short_block_t tblock, const h264_imgpel_macroblock_t mb_pred, h264_imgpel_macroblock_t mb_rec, int pos_x, int pos_y);
extern void itrans4x4_mmx(const h264_short_block_t tblock, const h264_imgpel_macroblock_t mb_pred, h264_imgpel_macroblock_t mb_rec, int pos_x, int pos_y);
extern int intrapred (Macroblock *currMB, ColorPlane pl, int ioff,int joff,int i4,int j4);
extern void itrans_2 (Macroblock *currMB, ColorPlane pl);
extern void iTransform (Macroblock *currMB, ColorPlane pl, int smb);
extern void copy_image_data (imgpel **imgBuf1, imgpel **imgBuf2, int dest_x, int src_x, int width, int height);
extern void copy_image_data_16x16 (imgpel **imgBuf1, imgpel **imgBuf2, int dest_x, int src_x);
extern void copy_image_data_16x16_stride_c(struct video_image *destination, int dest_x, int dest_y, const h264_imgpel_macroblock_t source);
extern void copy_image_data_16x16_stride_sse(struct video_image *destination, int dest_x, int dest_y, const h264_imgpel_macroblock_t source);
extern void copy_image_data_8x8_stride (struct video_image *destination, int dest_x, int dest_y, const h264_imgpel_macroblock_t source);
extern void copy_image_data_8x8_stride2 (struct video_image *destination, int dest_x, int dest_y, const h264_imgpel_macroblock_t source, int src_x, int src_y);
extern void copy_image_data_4x4_stride (struct video_image *destination, int dest_x, int dest_y, const h264_imgpel_macroblock_t source, int src_x, int src_y);
extern void copy_image_data_stride (struct video_image *destination, int dest_x, int dest_y, const h264_imgpel_macroblock_t source, int width, int height);
#endif

View File

@ -0,0 +1,64 @@
/*!
***************************************************************************
* \file
* cabac.h
*
* \brief
* Header file 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"
typedef struct Run_Level
{
int level;
int run;
} RunLevel;
extern MotionInfoContexts* create_contexts_MotionInfo(void);
extern TextureInfoContexts* create_contexts_TextureInfo(void);
extern void delete_contexts_MotionInfo(MotionInfoContexts *enco_ctx);
extern void delete_contexts_TextureInfo(TextureInfoContexts *enco_ctx);
extern void cabac_new_slice(Slice *currSlice);
extern int readMB_typeInfo_CABAC(Macroblock *currMB, DecodingEnvironmentPtr dep_dp);
extern int readB8_typeInfo_CABAC(Slice *currSlice, DecodingEnvironmentPtr dep_dp);
extern int readIntraPredMode_CABAC(Slice *currSlice, DecodingEnvironmentPtr dep_dp);
extern char readRefFrame_CABAC(Macroblock *currMB, DecodingEnvironmentPtr dep_dp, int list, int x, int y);
extern char readRefFrame_CABAC0(Macroblock *currMB, DecodingEnvironmentPtr dep_dp, int list, int y);
extern int readMVD_CABAC(Macroblock *currMB, DecodingEnvironmentPtr dep_dp, int k, int list, int x, int y);
extern int readCBP_CABAC (Macroblock *currMB, DecodingEnvironmentPtr dep_dp);
// readRunLevel_CABAC returns level and sets *run
extern RunLevel readRunLevel_CABAC(Macroblock *currMB, DecodingEnvironmentPtr dep_dp, int context);
extern short readDquant_CABAC(Slice *currSlice, DecodingEnvironmentPtr dep_dp);
extern char readCIPredMode_CABAC (Macroblock *currMB, DecodingEnvironmentPtr dep_dp);
extern int readMB_skip_flagInfo_CABAC (Macroblock *currMB, DecodingEnvironmentPtr dep_dp);
extern Boolean readFieldModeInfo_CABAC (Macroblock *currMB, DecodingEnvironmentPtr dep_dp);
extern Boolean readMB_transform_size_flag_CABAC(Macroblock *currMB, DecodingEnvironmentPtr dep_dp);
extern void readIPCM_CABAC(Slice *currSlice, struct datapartition *dP);
extern int cabac_startcode_follows(Slice *currSlice, int eos_bit);
extern int check_next_mb_and_get_field_mode_CABAC(Slice *currSlice, DataPartition *act_dp);
extern void CheckAvailabilityOfNeighborsCABAC(Macroblock *currMB);
extern void set_read_and_store_CBP(Macroblock **currMB, int chroma_format_idc);
#endif // _CABAC_H_

View File

@ -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_
extern void init_contexts (Slice *currslice);
#endif

View File

@ -0,0 +1,223 @@
/*! \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
Fraunhofer-Institute for Telecommunications Heinrich-Hertz-Institut (HHI), 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
Sejong Univ., Digital Media System Lab., Korea
\endverbatim
\par Full Contact Information
\verbatim
Lowell Winger <lwinger@videolocus.com><lwinger@uwaterloo.ca>
Guy C<>t<EFBFBD> <gcote@videolocus.com>
Michael Gallant <mgallant@videolocus.com>
VideoLocus Inc.
97 Randall Dr.
Waterloo, ON, Canada N2V1C5
Inge Lille-Lang<6E>y <inge.lille-langoy@telenor.com>
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
Fraunhofer-Institute for Telecommunications
Heinrich-Hertz-Institut (HHI)
Einsteinufer 37
10587 Berlin
Germany
Gabi Blaettermann
Fraunhofer-Institute for Telecommunications
Heinrich-Hertz-Institut (HHI)
Einsteinufer 37
10587 Berlin
Germany
Detlev Marpe <marpe@hhi.de>
Fraunhofer-Institute for Telecommunications
Heinrich-Hertz-Institut (HHI)
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>
Fraunhofer-Institute for Telecommunications
Heinrich-Hertz-Institut (HHI)
Einsteinufer 37
10587 Berlin
Germany
Heiko Schwarz <hschwarz@hhi.de>
Fraunhofer-Institute for Telecommunications
Heinrich-Hertz-Institut (HHI)
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
Shun-ichi Sekiguchi <Sekiguchi.Shunichi@eb.MitsubishiElectric.co.jp>
Information Technology R&D Center,
Mitsubishi Electric Corporation
5-1-1, Ofuna, Kamakura, Japan
Yung-Lyul Lee <yllee@sejong.ac.kr>
Ki-Hun Han <khhan@dms.sejong.ac.kr>
Department of Computer Engineering,
Sejong University
98 Kunja-Dong, Kwangjin-Gu, Seoul 143-747, Korea
\endverbatim
*/

View File

@ -0,0 +1,273 @@
/*!
**************************************************************************
* \file defines.h
*
* \brief
* Header file containing some useful global definitions
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Detlev Marpe
* - Karsten S<>hring <suehring@hhi.de>
* - Alexis Michael Tourapis <alexismt@ieee.org>
*
*
* \date
* 21. March 2001
**************************************************************************
*/
#ifndef H264_DEFINES_H_
#define H264_DEFINES_H_
#pragma once
#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
#define JM "16.1 (FRExt)"
#define VERSION "16.1"
#define EXT_VERSION "(FRExt)"
#define DUMP_DPB 0 //!< Dump DPB info for debug purposes
#define PAIR_FIELDS_IN_OUTPUT 0 //!< Pair field pictures for output purposes
#define IMGTYPE 0 //!< Define imgpel size type. 0 implies byte (cannot handle >8 bit depths) and 1 implies unsigned short
#define ENABLE_FIELD_CTX 1 //!< Enables Field mode related context types for CABAC
#define ENABLE_HIGH444_CTX 1 //!< Enables High 444 profile context types for CABAC.
#define ZEROSNR 0 //!< PSNR computation method
#define ENABLE_OUTPUT_TONEMAPPING 1 //!< enable tone map the output if tone mapping SEI present
#include "typedefs.h"
#define H264_MEMORY_ALIGNMENT 32
//#define MAX_NUM_SLICES 150
#define MAX_NUM_SLICES 50
#define MAX_REFERENCE_PICTURES 32 //!< H.264 allows 32 fields
#define MAX_CODED_FRAME_SIZE 8000000 //!< bytes for one frame
//AVC Profile IDC definitions
#define BASELINE 66 //!< YUV 4:2:0/8 "Baseline"
#define MAIN 77 //!< YUV 4:2:0/8 "Main"
#define EXTENDED 88 //!< YUV 4:2:0/8 "Extended"
#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 244 //!< YUV 4:4:4/14 "High 4:4:4"
#define FREXT_CAVLC444 44 //!< YUV 4:4:4/14 "CAVLC 4:4:4"
#define FILE_NAME_SIZE 255
#define INPUT_TEXT_SIZE 1024
#if (ENABLE_HIGH444_CTX == 1)
# define NUM_BLOCK_TYPES 22
#else
# define NUM_BLOCK_TYPES 10
#endif
//#define _LEAKYBUCKET_
#define BLOCK_SHIFT 2
#define BLOCK_SIZE 4
#define BLOCK_SIZE_8x8 8
#define SMB_BLOCK_SIZE 8
#define BLOCK_PIXELS 16
#define MB_BLOCK_SIZE 16
#define MB_PIXELS 256 // MB_BLOCK_SIZE * MB_BLOCK_SIZE
#define MB_PIXELS_SHIFT 8 // log2(MB_BLOCK_SIZE * MB_BLOCK_SIZE)
#define MB_BLOCK_SHIFT 4
#define BLOCK_MULTIPLE 4 // (MB_BLOCK_SIZE/BLOCK_SIZE)
#define MB_BLOCK_PARTITIONS 16 // (BLOCK_MULTIPLE * BLOCK_MULTIPLE)
#define BLOCK_CONTEXT 64 // (4 * MB_BLOCK_PARTITIONS)
// These variables relate to the subpel accuracy supported by the software (1/4)
#define BLOCK_SIZE_SP 16 // BLOCK_SIZE << 2
#define BLOCK_SIZE_8x8_SP 32 // BLOCK_SIZE8x8 << 2
// Available MB modes
enum {
PSKIP = 0,
BSKIP_DIRECT = 0,
P16x16 = 1,
P16x8 = 2,
P8x16 = 3,
SMB8x8 = 4,
SMB8x4 = 5,
SMB4x8 = 6,
SMB4x4 = 7,
P8x8 = 8,
I4MB = 9,
I16MB = 10,
IBLOCK = 11,
SI4MB = 12,
I8MB = 13,
IPCM = 14,
MAXMODE = 15
} ;//MBModeTypes;
// number of intra prediction modes
#define NO_INTRA_PMODE 9
// Direct Mode types
enum {
DIR_TEMPORAL = 0, //!< Temporal Direct Mode
DIR_SPATIAL = 1 //!< Spatial Direct Mode
} ;//DirectModes;
// CAVLC block types
enum {
LUMA = 0,
LUMA_INTRA16x16DC = 1,
LUMA_INTRA16x16AC = 2,
CB = 3,
CB_INTRA16x16DC = 4,
CB_INTRA16x16AC = 5,
CR = 8,
CR_INTRA16x16DC = 9,
CR_INTRA16x16AC = 10
} ;//CAVLCBlockTypes;
// CABAC block types
enum {
LUMA_16DC = 0,
LUMA_16AC = 1,
LUMA_8x8 = 2,
LUMA_8x4 = 3,
LUMA_4x8 = 4,
LUMA_4x4 = 5,
CHROMA_DC = 6,
CHROMA_AC = 7,
CHROMA_DC_2x4 = 8,
CHROMA_DC_4x4 = 9,
CB_16DC = 10,
CB_16AC = 11,
CB_8x8 = 12,
CB_8x4 = 13,
CB_4x8 = 14,
CB_4x4 = 15,
CR_16DC = 16,
CR_16AC = 17,
CR_8x8 = 18,
CR_8x4 = 19,
CR_4x8 = 20,
CR_4x4 = 21
} ;//CABACBlockTypes;
// Macro defines
#define Q_BITS 15
#define DQ_BITS 6
#define Q_BITS_8 16
#define DQ_BITS_8 6
//#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_INTRA(MB) (!!((1 << (MB)->mb_type) & ((1<<I4MB) | (1<<I16MB) | (1<<IPCM) | (1<<I8MB) | (1<<SI4MB))))
#define IS_I16MB(MB) ((MB)->mb_type==I16MB || (MB)->mb_type==IPCM)
#define IS_INTER(MB) (!IS_INTRA(MB))
//#define IS_INTER(MB) ((MB)->mb_type!=SI4MB && (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 && (currSlice->slice_type == B_SLICE ))
#define IS_SKIP(MB) ((MB)->mb_type==0 && (currSlice->slice_type == P_SLICE || currSlice->slice_type == SP_SLICE))
#define TOTRUN_NUM 15
#define RUNBEFORE_NUM 7
#define RUNBEFORE_NUM_M1 6
// Quantization parameter range
#define MIN_QP 0
#define MAX_QP 51
// 4x4 intra prediction modes
enum {
VERT_PRED = 0,
HOR_PRED = 1,
DC_PRED = 2,
DIAG_DOWN_LEFT_PRED = 3,
DIAG_DOWN_RIGHT_PRED = 4,
VERT_RIGHT_PRED = 5,
HOR_DOWN_PRED = 6,
VERT_LEFT_PRED = 7,
HOR_UP_PRED = 8
} ;//I4x4PredModes;
// 16x16 intra prediction modes
enum {
VERT_PRED_16 = 0,
HOR_PRED_16 = 1,
DC_PRED_16 = 2,
PLANE_16 = 3
} ;//I16x16PredModes;
// 8x8 chroma intra prediction modes
enum {
DC_PRED_8 = 0,
HOR_PRED_8 = 1,
VERT_PRED_8 = 2,
PLANE_8 = 3
} ;//I8x8PredModes;
enum {
EOS = 1, //!< End Of Sequence
SOP = 2, //!< Start Of Picture
SOS = 3 //!< Start Of Slice
};
// MV Prediction types
enum {
MVPRED_MEDIAN = 0,
MVPRED_L = 1,
MVPRED_U = 2,
MVPRED_UR = 3
} ;//MVPredTypes;
enum {
DECODING_OK = 0,
SEARCH_SYNC = 1,
PICTURE_DECODED = 2
};
#define LAMBDA_ACCURACY_BITS 16
#define INVALIDINDEX (-135792468)
#define RC_MAX_TEMPORAL_LEVELS 5
//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
#define MAX_PLANE 3
#define IS_INDEPENDENT(IMG) ((IMG)->separate_colour_plane_flag)
#define IS_FREXT_PROFILE(profile_idc) ( profile_idc>=FREXT_HP || profile_idc == FREXT_CAVLC444 )
#define HI_INTRA_ONLY_PROFILE (((p_Vid->active_sps->profile_idc>=FREXT_Hi10P)&&(p_Vid->active_sps->constrained_set3_flag))||(p_Vid->active_sps->profile_idc==FREXT_CAVLC444))
enum
{
VUI_AR_UNDEFINED = 0,
VUI_AR_SQUARE = 1, // 1:1
VUI_AR_12_11 = 2, // 12:11
VUI_AR_10_11 = 3, // 10:11
VUI_AR_16_11 = 4, // 16:11
VUI_AR_40_33 = 5, // 40:33
VUI_AR_24_11 = 6, // 24:11
VUI_AR_20_11 = 7, // 20:11
VUI_AR_32_11 = 8, // 32:11
VUI_AR_80_33 = 9, // 80:33
VUI_AR_18_11 = 10, // 18:11
VUI_AR_15_11 = 11, // 15:11
VUI_AR_64_33 = 12, // 64:33
VUI_AR_160_99 = 13, // 160:99
VUI_AR_4_3 = 14, // 4:3
VUI_AR_3_2 = 15, // 3:2
VUI_AR_2_1 = 16, // 2:1
VUI_EXTENDED_SAR = 255,
};
#endif

View File

@ -0,0 +1,112 @@
/*!
*************************************************************************************
* \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.
*/
static const byte assignSE2partition[][SE_MAX_ELEMENTS] =
{
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 // element number (do not uncomment)
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, //!< all elements in one partition no data partitioning
{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 2, 2, 2, 2, 0, 0, 0, 0 } //!< three partitions per slice
};
#endif

View File

@ -0,0 +1,159 @@
/*!
************************************************************************
* \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
/*
* 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(VideoParameters *p_Vid, 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( VideoParameters *p_Vid, 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( VideoParameters *p_Vid, 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;
};
extern struct concealment_node * init_node(StorablePicture* , int );
extern void print_node( struct concealment_node * );
extern void print_list( struct concealment_node * );
extern void init_lists_for_non_reference_loss(VideoParameters *p_Vid, int , PictureStructure );
extern void conceal_non_ref_pics(VideoParameters *p_Vid, int diff);
extern void conceal_lost_frames(VideoParameters *p_Vid);
extern void sliding_window_poc_management(DecodedPictureBuffer *p_Dpb, StorablePicture *p);
extern void write_lost_non_ref_pic(VideoParameters *p_Vid, int poc);
extern void write_lost_ref_after_idr(VideoParameters *p_Vid, int pos);
extern int comp(const void *, const void *);
#endif

View File

@ -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 (VideoParameters *p_Vid, 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

View File

@ -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 "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 frame_s
{
VideoParameters *p_Vid;
imgpel *yptr;
imgpel *uptr;
imgpel *vptr;
} frame;
//! region structure stores information about a region that is needed for concealment
typedef struct object_buffer
{
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
short mv[3]; //!< motion vectors in 1/4 pixel units: mvx = mv[0], mvy = mv[1],
//!< and ref_frame = mv[2]
} objectBuffer_t;
#endif

View File

@ -0,0 +1,20 @@
/*!
****************************************************************************
* \file errorconcealment.h
*
* \brief
* Header file for errorconcealment.c
*
****************************************************************************
*/
#ifndef _ERRORCONCEALMENT_H_
#define _ERRORCONCEALMENT_H_
extern int set_ec_flag(VideoParameters *p_Vid, int se);
extern void reset_ec_flags(VideoParameters *p_Vid);
#endif

View File

@ -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_
extern int fmo_init (VideoParameters *p_Vid);
extern int FmoFinit (VideoParameters *p_Vid);
extern int FmoGetNumberOfSliceGroup(VideoParameters *p_Vid);
extern int FmoGetLastMBOfPicture (VideoParameters *p_Vid);
extern int FmoGetLastMBInSliceGroup(VideoParameters *p_Vid, int SliceGroup);
extern int FmoGetSliceGroupId (VideoParameters *p_Vid, int mb);
extern int FmoGetNextMBNr (VideoParameters *p_Vid, int CurrentMbNr);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
/*!
*************************************************************************************
* \file header.h
*
* \brief
* Prototypes for header.c
*************************************************************************************
*/
#ifndef _HEADER_H_
#define _HEADER_H_
extern void FirstPartOfSliceHeader(Slice *currSlice);
extern void RestOfSliceHeader (Slice *currSlice);
extern void dec_ref_pic_marking(VideoParameters *p_Vid, Bitstream *currStream);
extern void decode_poc(VideoParameters *p_Vid);
extern int dumppoc(VideoParameters *p_Vid);
#endif

View File

@ -0,0 +1,33 @@
/*!
************************************************************************
* \file image.h
*
* \brief
* prototypes for image.c
*
************************************************************************
*/
#ifndef _IMAGE_H_
#define _IMAGE_H_
#include "mbuffer.h"
extern int picture_order(VideoParameters *p_Vid);
extern void decode_one_slice (Slice *currSlice);
extern void exit_picture(VideoParameters *p_Vid, StorablePicture **dec_picture);
extern int decode_one_frame(VideoParameters *p_Vid, uint64_t time_code);
extern int is_new_picture(StorablePicture *dec_picture, Slice *currSlice, OldSliceParams *p_old_slice);
extern void init_old_slice(OldSliceParams *p_old_slice);
// For 4:4:4 independent mode
extern void copy_dec_picture_JV( VideoParameters *p_Vid, StorablePicture *dst, StorablePicture *src );
extern void frame_postprocessing(VideoParameters *p_Vid);
extern void field_postprocessing(VideoParameters *p_Vid);
#endif

View File

@ -0,0 +1,25 @@
/*!
*************************************************************************************
* \file intra16x16_pred.h
*
* \brief
* definitions for intra 16x16 prediction
*
* \author
* Main contributors (see contributors.h for copyright,
* address and affiliation details)
* - Alexis Michael Tourapis <alexismt@ieee.org>
*
*************************************************************************************
*/
#ifndef _INTRA16x16_PRED_H_
#define _INTRA16x16_PRED_H_
#include "global.h"
#include "mbuffer.h"
extern int intrapred16x16(Macroblock *currMB, ColorPlane pl, int b8);
#endif

View File

@ -0,0 +1,25 @@
/*!
*************************************************************************************
* \file intra4x4_pred.h
*
* \brief
* definitions for intra 4x4 prediction
*
* \author
* Main contributors (see contributors.h for copyright,
* address and affiliation details)
* - Alexis Michael Tourapis <alexismt@ieee.org>
*
*************************************************************************************
*/
#ifndef _INTRA4x4_PRED_H_
#define _INTRA4x4_PRED_H_
#include "global.h"
#include "mbuffer.h"
extern int intrapred(Macroblock *currMB, ColorPlane pl, int ioff, int joff, int img_block_x, int img_block_y);
#endif

View File

@ -0,0 +1,25 @@
/*!
*************************************************************************************
* \file intra8x8_pred.h
*
* \brief
* definitions for intra 8x8 prediction
*
* \author
* Main contributors (see contributors.h for copyright,
* address and affiliation details)
* - Alexis Michael Tourapis <alexismt@ieee.org>
*
*************************************************************************************
*/
#ifndef _INTRA8x8_PRED_H_
#define _INTRA8x8_PRED_H_
#include "global.h"
#include "mbuffer.h"
extern int intrapred8x8(Macroblock *currMB, ColorPlane pl, int ioff, int joff);
#endif

View File

@ -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(InputParameters *p_Inp);
#endif
#endif

View File

@ -0,0 +1,23 @@
/*!
************************************************************************
* \file
* loopfilter.h
* \brief
* external deblocking filter interface
************************************************************************
*/
#ifndef _LOOPFILTER_H_
#define _LOOPFILTER_H_
#include "global.h"
#include "mbuffer.h"
extern void DeblockPicture(VideoParameters *p_Vid, StorablePicture *p) ;
extern void EdgeLoopLumaNormal_Horiz(ColorPlane pl, VideoImage *image, const byte Strength[MB_BLOCK_SIZE], Macroblock *MbQ, int edge, StorablePicture *p);
extern void EdgeLoopLumaNormal_Horiz_sse2(ColorPlane pl, VideoImage *image, const byte Strength[MB_BLOCK_SIZE], Macroblock *MbQ, int edge, StorablePicture *p);
extern void EdgeLoopChromaNormal_Horiz(VideoImage *image, const byte Strength[16], Macroblock *MbQ, int edge, int uv, StorablePicture *p);
#endif //_LOOPFILTER_H_

View File

@ -0,0 +1,177 @@
/*!
************************************************************************
* \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_
#include "global.h"
#include "mbuffer.h"
#include "block.h"
//! single scan pattern
static 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}
};
static const byte SNGL_SCAN_1D[16] = { 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15};
static const byte SNGL_SCAN_DC[16] = { 0, 1, 2, 8, 3, 4, 5, 6, 9, 10, 11, 12, 7, 13, 14, 15};
//! field scan pattern
static 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}
};
static const byte FIELD_SCAN_1D[16] = {0, 4, 1, 8, 12, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15};
static const byte FIELD_SCAN_DC[16] = {0, 2, 1, 8, 10, 3, 9, 11, 4, 6, 12, 14, 5, 7, 13, 15};
//! used to control block sizes : Not used/16x16/16x8/8x16/8x8/8x4/4x8/4x4
static const int BLOCK_STEP[8][2]=
{
{0,0},{4,4},{4,2},{2,4},{2,2},{2,1},{1,2},{1,1}
};
//! single scan pattern
static 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}
};
static const byte SNGL_SCAN8x8_1D[64] =
{
0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34,
27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36,
29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46,
53, 60, 61, 54, 47, 55, 62, 63
};
//! field scan pattern
static 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 byte FIELD_SCAN8x8_1D[64] =
{
0, 8, 16, 1, 9, 24, 32, 17,
2, 25, 40, 48, 56, 33, 10, 3,
18, 41, 49, 57, 26, 11, 4, 19,
34, 42, 50, 58, 27, 12, 5, 20,
35, 43, 51, 59, 28, 13, 6, 21,
36, 44, 52, 60, 29, 14, 22, 37,
45, 53, 61, 30, 7, 15, 38, 46,
54, 62, 23, 31, 39, 47, 55, 63
};
//! single scan pattern
static const byte SCAN_YUV422[8][2] =
{
{0,0},{0,1},
{1,0},{0,2},
{0,3},{1,1},
{1,2},{1,3}
};
static const 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}
};
static const unsigned char cofuv_blk_x[3][8][4] =
{ { {0, 1, 0, 1},
{0, 1, 0, 1},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0} },
{ {0, 1, 0, 1},
{0, 1, 0, 1},
{0, 1, 0, 1},
{0, 1, 0, 1},
{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 const unsigned char cofuv_blk_y[3][8][4] =
{
{ { 0, 0, 1, 1},
{ 0, 0, 1, 1},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0} },
{ { 0, 0, 1, 1},
{ 2, 2, 3, 3},
{ 0, 0, 1, 1},
{ 2, 2, 3, 3},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0} },
{ { 0, 0, 1, 1},
{ 0, 0, 1, 1},
{ 2, 2, 3, 3},
{ 2, 2, 3, 3},
{ 0, 0, 1, 1},
{ 0, 0, 1, 1},
{ 2, 2, 3, 3},
{ 2, 2, 3, 3}}
};
extern void setup_slice_methods(Slice *currSlice);
extern void get_neighbors(Macroblock *currMB, PixelPos *block, int mb_x, int mb_y, int blockshape_x);
extern void get_neighbors0016(Macroblock *currMB, PixelPos *block);
extern void start_macroblock (Slice *currSlice, Macroblock **currMB);
extern int decode_one_macroblock(Macroblock *currMB, StorablePicture *dec_picture);
extern Boolean exit_macroblock (Slice *currSlice, int eos_bit);
#endif

View File

@ -0,0 +1,33 @@
/*!
*************************************************************************************
* \file mb_prediction.h
*
* \brief
* Functions for macroblock prediction
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Alexis Michael Tourapis <alexismt@ieee.org>
*************************************************************************************
*/
#ifndef _MB_PREDICTION_H_
#define _MB_PREDICTION_H_
extern int mb_pred_intra4x4 (Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, StorablePicture *dec_picture);
extern int mb_pred_intra16x16 (Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, StorablePicture *dec_picture);
extern int mb_pred_intra8x8 (Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, StorablePicture *dec_picture);
extern void mb_pred_skip (Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, StorablePicture *dec_picture);
extern void mb_pred_sp_skip (Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, StorablePicture *dec_picture);
extern void mb_pred_p_inter8x8 (Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, StorablePicture *dec_picture);
extern void mb_pred_p_inter16x16(Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, StorablePicture *dec_picture);
extern void mb_pred_p_inter16x8 (Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, StorablePicture *dec_picture);
extern void mb_pred_p_inter8x16 (Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, StorablePicture *dec_picture);
extern void mb_pred_b_dspatial (Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, StorablePicture *dec_picture);
extern void mb_pred_b_dtemporal (Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, StorablePicture *dec_picture);
extern void mb_pred_b_inter8x8 (Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, StorablePicture *dec_picture);
extern void mb_pred_ipcm (Macroblock *currMB);
#endif

View File

@ -0,0 +1,235 @@
/*!
***********************************************************************
* \file
* mbuffer.h
*
* \brief
* Frame buffer functions
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Karsten S<>hring <suehring@hhi.de>
* - Alexis Michael Tourapis <alexismt@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 _MBUFFER_H_
#define _MBUFFER_H_
#include "global.h"
#include <bfc/platform/types.h>
#define MAX_LIST_SIZE 33
//! definition of pic motion parameters
typedef struct pic_motion_params
{
PicMotion **motion[2];
h264_ref_t ***field_references;
byte * mb_field; //!< field macroblock indicator
byte ** field_frame; //!< indicates if co_located is field or frame.
int padding[1];
} PicMotionParams;
typedef struct video_image
{
imgpel **img;
imgpel *base_address;
size_t stride;
struct video_image *next; // for the memory cacher
} VideoImage;
//! definition a picture (field or frame)
typedef struct storable_picture
{
PictureStructure structure;
int poc;
int top_poc;
int bottom_poc;
int frame_poc;
h264_ref_t ref_pic_num [MAX_NUM_SLICES][6][MAX_LIST_SIZE];
h264_ref_t frm_ref_pic_num [MAX_NUM_SLICES][6][MAX_LIST_SIZE];
h264_ref_t top_ref_pic_num [MAX_NUM_SLICES][6][MAX_LIST_SIZE];
h264_ref_t 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;
byte 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 mb_aff_frame_flag;
unsigned PicWidthInMbs;
unsigned PicSizeInMbs;
//imgpel ** imgY; //!< Y picture component
union
{
VideoImage *plane_images[3]; // to ensure array alignment
struct
{
VideoImage *imgY;
VideoImage *imgUV[2]; //!< U and V picture components
};
};
struct pic_motion_params motion; //!< Motion info
struct pic_motion_params JVmotion[MAX_PLANE]; //!< Motion info for 4:4:4 independent mode decoding
short ** slice_id; //!< reference picture [mb_x][mb_y]
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 picture
// variables for tone mapping
int seiHasTone_mapping;
int tone_mapping_model_id;
int tonemapped_bit_depth;
imgpel* tone_mapping_lut; //!< tone mapping look up table
int retain_count; // benski> we're going to reference count these things
uint64_t time_code; // user-passed timecode for this frame
} StorablePicture;
//! definition a picture (field or frame)
typedef struct colocated_params
{
int mb_adaptive_frame_field_flag;
int size_x, size_y;
byte is_long_term;
MotionParams frame;
MotionParams top;
MotionParams bottom;
} 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
{
VideoParameters *p_Vid;
InputParameters *p_Inp;
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 void init_dpb(VideoParameters *p_Vid);
extern void free_dpb(VideoParameters *p_Vid);
extern FrameStore* alloc_frame_store(void);
extern void free_frame_store(VideoParameters *p_Vid, FrameStore* f);
extern StorablePicture* alloc_storable_picture(VideoParameters *p_Vid, PictureStructure type, int size_x, int size_y, int size_x_cr, int size_y_cr);
extern void free_storable_picture(VideoParameters *p_Vid, StorablePicture* p);
extern void store_picture_in_dpb(VideoParameters *p_Vid, StorablePicture* p);
extern void flush_dpb(VideoParameters *p_Vid);
extern void dpb_split_field (VideoParameters *p_Vid, FrameStore *fs);
extern void dpb_combine_field(VideoParameters *p_Vid, FrameStore *fs);
extern void dpb_combine_field_yuv(VideoParameters *p_Vid, FrameStore *fs);
extern void init_lists (Slice *currSlice);
extern void reorder_ref_pic_list(VideoParameters *p_Vid, StorablePicture **list, char *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);
extern void init_mbaff_lists(VideoParameters *p_Vid);
extern void alloc_ref_pic_list_reordering_buffer(Slice *currSlice);
extern void free_ref_pic_list_reordering_buffer(Slice *currSlice);
extern void fill_frame_num_gap(VideoParameters *p_Vid);
extern ColocatedParams* alloc_colocated(VideoParameters *p_Vid, int size_x, int size_y,int mb_adaptive_frame_field_flag);
extern void free_colocated(VideoParameters *p_Vid, ColocatedParams* p);
extern void compute_colocated (Slice *currSlice, ColocatedParams* p, StorablePicture **listX[6]);
extern void compute_colocated_frames_mbs (Slice *currSlice, ColocatedParams* p, StorablePicture **listX[6]);
// For 4:4:4 independent mode
extern void compute_colocated_JV ( Slice *currSlice, ColocatedParams* p, StorablePicture **listX[6]);
extern void copy_storable_param_JV( VideoParameters *p_Vid, PicMotionParams *JVplane, PicMotionParams *motion );
// benski> decoded output pictures
void out_storable_picture_get(VideoParameters *img, StorablePicture **pic);
void out_storable_picture_add(VideoParameters *img, StorablePicture *pic);
void out_storable_pictures_init(VideoParameters *img, size_t count);
void out_storable_pictures_destroy(VideoParameters *img);
#endif

View File

@ -0,0 +1,61 @@
/*!
*************************************************************************************
* \file mc_prediction.h
*
* \brief
* definitions for motion compensated prediction
*
* \author
* Main contributors (see contributors.h for copyright,
* address and affiliation details)
* - Alexis Michael Tourapis <alexismt@ieee.org>
*
*************************************************************************************
*/
#ifndef _MC_PREDICTION_H_
#define _MC_PREDICTION_H_
#include "global.h"
#include "mbuffer.h"
extern void get_block_luma (Macroblock *currMB, ColorPlane pl, StorablePicture *list, int x_pos, int y_pos, const short *motion_vector, int ver_block_size, int hor_block_size, h264_imgpel_macroblock_t block);
extern void intra_cr_decoding (Macroblock *currMB, int yuv);
extern void prepare_direct_params(Macroblock *currMB, StorablePicture *dec_picture, short pmvl0[2], short pmvl1[2],char *l0_rFrame, char *l1_rFrame);
extern void perform_mc (Macroblock *currMB, ColorPlane pl, StorablePicture *dec_picture, int pred_dir, int i, int j, int list_offset, int block_size_x, int block_size_y, int curr_mb_field);
extern void perform_mc16x16 (Macroblock *currMB, ColorPlane pl, StorablePicture *dec_picture, int pred_dir, int list_offset, int curr_mb_field);
extern void perform_mc16x8 (Macroblock *currMB, ColorPlane pl, StorablePicture *dec_picture, int pred_dir, int i, int j, int list_offset, int curr_mb_field);
extern void perform_mc8x8 (Macroblock *currMB, ColorPlane pl, StorablePicture *dec_picture, int pred_dir, int i, int j, int list_offset, int curr_mb_field);
extern void perform_mc8x16 (Macroblock *currMB, ColorPlane pl, StorablePicture *dec_picture, int pred_dir, int i, int j, int list_offset, int curr_mb_field);
void weighted_mc_prediction16x16_sse2(h264_imgpel_macroblock_row_t *mb_pred, int wp_scale, int wp_offset, int weight_denom);
void weighted_mc_prediction16x16_ipp(h264_imgpel_macroblock_row_t *mb_pred, int wp_scale, int wp_offset, int weight_denom);
void weighted_mc_prediction16x16_c(h264_imgpel_macroblock_row_t *mb_pred, int wp_scale, int wp_offset, int weight_denom);
void weighted_mc_prediction16x8_sse2(h264_imgpel_macroblock_row_t *mb_pred, int wp_scale, int wp_offset, int weight_denom);
void weighted_mc_prediction16x8_ipp(h264_imgpel_macroblock_row_t *mb_pred, int wp_scale, int wp_offset, int weight_denom);
void weighted_mc_prediction16x8_c(h264_imgpel_macroblock_row_t *mb_pred, int wp_scale, int wp_offset, int weight_denom);
void weighted_mc_prediction8x8_sse2(h264_imgpel_macroblock_row_t *mb_pred, int wp_scale, int wp_offset, int weight_denom);
void weighted_mc_prediction8x8_ipp(h264_imgpel_macroblock_row_t *mb_pred, int wp_scale, int wp_offset, int weight_denom);
void weighted_mc_prediction8x8_c(h264_imgpel_macroblock_row_t *mb_pred, int wp_scale, int wp_offset, int weight_denom);
void weighted_bi_prediction8x8_sse2(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0, int wp_scale_l0, int wp_scale_l1, int wp_offset, int weight_denom);
void weighted_bi_prediction8x8_ipp(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0, int wp_scale_l0, int wp_scale_l1, int wp_offset, int weight_denom);
void weighted_bi_prediction8x8_c(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0, int wp_scale_l0, int wp_scale_l1, int wp_offset, int weight_denom);
void weighted_bi_prediction16x16_sse2(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0, int wp_scale_l0, int wp_scale_l1, int wp_offset, int weight_denom);
void weighted_bi_prediction16x16_ipp(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0, int wp_scale_l0, int wp_scale_l1, int wp_offset, int weight_denom);
void weighted_bi_prediction16x16_c(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0, int wp_scale_l0, int wp_scale_l1, int wp_offset, int weight_denom);
void weighted_bi_prediction16x8_sse2(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0, int wp_scale_l0, int wp_scale_l1, int wp_offset, int weight_denom);
void weighted_bi_prediction16x8_ipp(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0, int wp_scale_l0, int wp_scale_l1, int wp_offset, int weight_denom);
void weighted_bi_prediction16x8_c(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0, int wp_scale_l0, int wp_scale_l1, int wp_offset, int weight_denom);
void bi_prediction8x8_sse2(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0);
void bi_prediction8x8_ipp(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0);
#endif

View File

@ -0,0 +1,26 @@
#ifndef _MEMINPUT_H
#define _MEMINPUT_H
#pragma once
#include "nalucommon.h"
#include <bfc/platform/types.h>
typedef struct memory_input_struct
{
const uint8_t *user_buffer;
size_t user_buffer_size;
size_t user_buffer_read;
uint8_t *Buf;
int resetting;
int skip_b_frames;
} memory_input_t;
int GetMemoryNALU (VideoParameters *p_Vid, NALU_t *nalu);
void OpenMemory(VideoParameters *p_Vid, const char *fn);
void CloseMemory(VideoParameters *p_Vid);
void malloc_mem_input(VideoParameters *p_Vid);
void free_mem_input(VideoParameters *p_Vid);
#endif

View File

@ -0,0 +1,28 @@
/*!
**************************************************************************************
* \file
* nalu.h
* \brief
* Common NALU support functions
*
* \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 "nalucommon.h"
extern void initBitsFile (VideoParameters *p_Vid);
extern void CheckZeroByteNonVCL(VideoParameters *p_Vid, NALU_t *nalu);
extern void CheckZeroByteVCL (VideoParameters *p_Vid, NALU_t *nalu);
extern int read_next_nalu(VideoParameters *p_Vid, NALU_t *nalu);
#endif

View File

@ -0,0 +1,46 @@
#pragma once
typedef struct optimized_functions
{
//void (*itrans4x4)(const h264_short_macroblock_t tblock, const h264_imgpel_macroblock_t mb_pred, h264_imgpel_macroblock_t mb_rec, int pos_x, int pos_y);
void (*itrans8x8)(h264_imgpel_macroblock_row_t *mb_rec, const h264_imgpel_macroblock_row_t *mb_pred, const h264_short_8x8block_row_t *block, int pos_x);
void (*weighted_mc_prediction16x16)(h264_imgpel_macroblock_row_t *mb_pred, int wp_scale, int wp_offset, int weight_denom);
void (*weighted_mc_prediction16x8)(h264_imgpel_macroblock_row_t *mb_pred, int wp_scale, int wp_offset, int weight_denom);
void (*weighted_mc_prediction8x8)(h264_imgpel_macroblock_row_t *mb_pred, int wp_scale, int wp_offset, int weight_denom);
void (*weighted_bi_prediction16x16)(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0, int wp_scale_l0, int wp_scale_l1, int wp_offset, int weight_denom);
void (*weighted_bi_prediction16x8)(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0, int wp_scale_l0, int wp_scale_l1, int wp_offset, int weight_denom);
void (*weighted_bi_prediction8x8)(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0, int wp_scale_l0, int wp_scale_l1, int wp_offset, int weight_denom);
void (*bi_prediction8x8)(h264_imgpel_macroblock_row_t *mb_pred, const h264_imgpel_macroblock_t block_l0);
void (*copy_image_data_16x16_stride)(struct video_image *destination, int dest_x, int dest_y, const h264_imgpel_macroblock_t source);
int (*code_from_bitstream_2d_5_4)(SyntaxElement *sym, Bitstream *currStream, const uint8_t *lentab, const uint8_t *codtab, const uint8_t *masktab);
int (*code_from_bitstream_2d_17_4)(SyntaxElement *sym, Bitstream *currStream, const uint16_t *lentab, const uint16_t *codtab, const uint16_t *masktab);
int (*code_from_bitstream_2d_16_1)(Bitstream *currStream, const uint16_t *lentab, const uint16_t *codtab, const uint16_t *masktab);
} OptimizedFunctions;
extern OptimizedFunctions opt;
/* define macros for these function calls. this way we could do specific builds that call the functions directly, if we have the need */
#ifdef _DEBUG
#define opt_itrans4x4 (itrans4x4_c)
#else
#define opt_itrans4x4 (itrans4x4_mmx)
#endif
#define opt_itrans8x8 (opt.itrans8x8)
#define opt_weighted_mc_prediction16x16 (opt.weighted_mc_prediction16x16)
#define opt_weighted_mc_prediction16x8 (opt.weighted_mc_prediction16x8)
#define opt_weighted_mc_prediction8x8 (opt.weighted_mc_prediction8x8)
#define opt_weighted_bi_prediction16x16 (opt.weighted_bi_prediction16x16)
#define opt_weighted_bi_prediction16x8 (opt.weighted_bi_prediction16x8)
#define opt_weighted_bi_prediction8x8 (opt.weighted_bi_prediction8x8)
#define opt_bi_prediction8x8 (opt.bi_prediction8x8)
#define opt_copy_image_data_16x16_stride (opt.copy_image_data_16x16_stride)
#define opt_code_from_bitstream_2d_5_4 (opt.code_from_bitstream_2d_5_4)
#define opt_code_from_bitstream_2d_17_4 (opt.code_from_bitstream_2d_17_4)
#define opt_code_from_bitstream_2d_16_1 (opt.code_from_bitstream_2d_16_1)

View File

@ -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_
extern void write_stored_frame(VideoParameters *p_Vid, FrameStore *fs);
extern void direct_output (VideoParameters *p_Vid, StorablePicture *p);
extern void init_out_buffer (VideoParameters *p_Vid);
extern void uninit_out_buffer (VideoParameters *p_Vid);
#if (PAIR_FIELDS_IN_OUTPUT)
extern void flush_pending_output(VideoParameters *p_Vid);
#endif
#endif //_OUTPUT_H_

View File

@ -0,0 +1,56 @@
/*!
**************************************************************************************
* \file
* parset.h
* \brief
* Picture and Sequence Parameter Sets, decoder operations
*
* \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"
static const byte ZZ_SCAN[16] =
{ 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
};
static const byte ZZ_SCAN8[64] =
{ 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
};
extern void Scaling_List(int *scalingList, int sizeOfScalingList, Boolean *UseDefaultScalingMatrix, Bitstream *s);
extern void InitVUI(seq_parameter_set_rbsp_t *sps);
extern int ReadVUI(DataPartition *p, seq_parameter_set_rbsp_t *sps);
extern int ReadHRDParameters(DataPartition *p, hrd_parameters_t *hrd);
extern void PPSConsistencyCheck (pic_parameter_set_rbsp_t *pps);
extern void SPSConsistencyCheck (seq_parameter_set_rbsp_t *sps);
extern void MakePPSavailable (VideoParameters *p_Vid, int id, pic_parameter_set_rbsp_t *pps);
extern void MakeSPSavailable (VideoParameters *p_Vid, int id, seq_parameter_set_rbsp_t *sps);
extern void ProcessSPS (VideoParameters *p_Vid, NALU_t *nalu);
extern void ProcessPPS (VideoParameters *p_Vid, NALU_t *nalu);
extern void UseParameterSet (Slice *currSlice, int PicParsetId);
extern void CleanUpPPS(VideoParameters *p_Vid);
extern void activate_sps (VideoParameters *p_Vid, seq_parameter_set_rbsp_t *sps);
extern void activate_pps (VideoParameters *p_Vid, pic_parameter_set_rbsp_t *pps);
#endif

View File

@ -0,0 +1,202 @@
/*!
**************************************************************************************
* \file
* parsetcommon.h
* \brief
* Picture and Sequence Parameter Sets, structures 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>
***************************************************************************************
*/
// 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 signaled 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 MAXSPS 32
#define MAXPPS 256
#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 short sar_width; // u(16)
unsigned short 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 int 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[12]; // u(1)
int ScalingList4x4[6][16]; // se(v)
int ScalingList8x8[6][64]; // se(v)
Boolean UseDefaultScalingMatrix4x4Flag[6];
Boolean UseDefaultScalingMatrix8x8Flag[6];
// if( pic_order_cnt_type < 2 ) in the sequence parameter set
Boolean bottom_field_pic_order_in_frame_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 pic_size_in_map_units_minus1; // ue(v)
byte *slice_group_id; // complete MBAmap u(v)
int num_ref_idx_l0_active_minus1; // ue(v)
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[12]; // u(1)
int ScalingList4x4[6][16]; // se(v)
int ScalingList8x8[6][64]; // se(v)
Boolean UseDefaultScalingMatrix4x4Flag[6];
Boolean UseDefaultScalingMatrix8x8Flag[6];
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 int 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
unsigned separate_colour_plane_flag; // u(1)
} seq_parameter_set_rbsp_t;
pic_parameter_set_rbsp_t *AllocPPS (void);
seq_parameter_set_rbsp_t *AllocSPS (void);
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

View File

@ -0,0 +1,169 @@
/*!
************************************************************************
* \file quant.h
*
* \brief
* definitions for quantization functions
*
* \author
*
************************************************************************
*/
#ifndef _QUANT_H_
#define _QUANT_H_
// exported variables
static const int dequant_coef8[6][64] =
{
{
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
}
};
//! Dequantization coefficients
static 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}}
};
static const int quant_coef[6][4][4] = {
{
{ 13107, 8066, 13107, 8066},
{ 8066, 5243, 8066, 5243},
{ 13107, 8066, 13107, 8066},
{ 8066, 5243, 8066, 5243}},
{
{ 11916, 7490, 11916, 7490},
{ 7490, 4660, 7490, 4660},
{ 11916, 7490, 11916, 7490},
{ 7490, 4660, 7490, 4660}},
{
{ 10082, 6554, 10082, 6554},
{ 6554, 4194, 6554, 4194},
{ 10082, 6554, 10082, 6554},
{ 6554, 4194, 6554, 4194}},
{
{ 9362, 5825, 9362, 5825},
{ 5825, 3647, 5825, 3647},
{ 9362, 5825, 9362, 5825},
{ 5825, 3647, 5825, 3647}},
{
{ 8192, 5243, 8192, 5243},
{ 5243, 3355, 5243, 3355},
{ 8192, 5243, 8192, 5243},
{ 5243, 3355, 5243, 3355}},
{
{ 7282, 4559, 7282, 4559},
{ 4559, 2893, 4559, 2893},
{ 7282, 4559, 7282, 4559},
{ 4559, 2893, 4559, 2893}}
};
// SP decoding parameter (EQ. 8-425)
static const int A[4][4] = {
{ 16, 20, 16, 20},
{ 20, 25, 20, 25},
{ 16, 20, 16, 20},
{ 20, 25, 20, 25}
};
// exported functions
// quantization initialization
extern void init_qp_process (VideoParameters *p_Vid);
extern void free_qp_matrices(VideoParameters *p_Vid);
// For Q-matrix
extern void assign_quant_params (Slice *currslice);
extern void CalculateQuant4x4Param(Slice *currslice);
#endif

View File

@ -0,0 +1,100 @@
/*!
*************************************************************************************
* \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_POST_FILTER_HINTS,
SEI_TONE_MAPPING,
SEI_MAX_ELEMENTS //!< number of maximum syntax elements
} SEI_type;
#define MAX_FN 256
// tone mapping information
#define MAX_CODED_BIT_DEPTH 12
#define MAX_SEI_BIT_DEPTH 12
#define MAX_NUM_PIVOTS (1<<MAX_CODED_BIT_DEPTH)
#if (ENABLE_OUTPUT_TONEMAPPING)
typedef struct tone_mapping_struct_s
{
Boolean seiHasTone_mapping;
unsigned int tone_map_repetition_period;
unsigned char coded_data_bit_depth;
unsigned char sei_bit_depth;
unsigned int model_id;
unsigned int count;
imgpel lut[1<<MAX_CODED_BIT_DEPTH]; //<! look up table for mapping the coded data value to output data value
Bitstream *data;
int payloadSize;
} ToneMappingSEI;
#endif
void InterpretSEIMessage(byte* msg, int size, VideoParameters *p_Vid);
void interpret_spare_pic( byte* payload, int size, VideoParameters *p_Vid );
void interpret_subsequence_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_subsequence_layer_characteristics_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_subsequence_characteristics_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_scene_information( byte* payload, int size, VideoParameters *p_Vid ); // JVT-D099
void interpret_user_data_registered_itu_t_t35_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_user_data_unregistered_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_pan_scan_rect_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_recovery_point_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_filler_payload_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_dec_ref_pic_marking_repetition_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_full_frame_freeze_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_full_frame_freeze_release_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_full_frame_snapshot_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_progressive_refinement_start_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_progressive_refinement_end_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_motion_constrained_slice_group_set_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_reserved_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_buffering_period_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_picture_timing_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_film_grain_characteristics_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_deblocking_filter_display_preference_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_stereo_video_info_info( byte* payload, int size, VideoParameters *p_Vid );
void interpret_post_filter_hints_info( byte* payload, int size, VideoParameters *p_Vid );
// functions for tone mapping SEI message
void interpret_tone_mapping( byte* payload, int size, VideoParameters *p_Vid );
#if (ENABLE_OUTPUT_TONEMAPPING)
void tone_map(imgpel** imgX, imgpel* lut, int size_x, int size_y);
void init_tone_mapping_sei(ToneMappingSEI *seiToneMapping);
void update_tone_mapping_sei(ToneMappingSEI *seiToneMapping);
#endif
#endif

View File

@ -0,0 +1,24 @@
/*!
***************************************************************************
*
* \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
**************************************************************************/
#ifndef _TRANSFORM8X8_H_
#define _TRANSFORM8X8_H_
extern void itrans8x8_mmx(h264_imgpel_macroblock_row_t *mb_rec, const h264_imgpel_macroblock_row_t *mb_pred, const h264_short_8x8block_row_t *block, int pos_x);
extern void itrans8x8_sse2(h264_imgpel_macroblock_row_t *mb_rec, const h264_imgpel_macroblock_row_t *mb_pred, const h264_short_8x8block_row_t *block, int pos_x);
extern void itrans8x8_c(h264_imgpel_macroblock_row_t *mb_rec, const h264_imgpel_macroblock_row_t *mb_pred, const h264_short_8x8block_row_t *block, int pos_x);
extern void itrans8x8_lossless(h264_imgpel_macroblock_row_t *mb_rec, const h264_imgpel_macroblock_row_t *mb_pred, const h264_short_8x8block_row_t *block, int pos_x);
#endif

View File

@ -0,0 +1,122 @@
/*!
************************************************************************
* \file vlc.h
*
* \brief
* header for (CA)VLC coding functions
*
* \author
* Karsten Suehring
*
************************************************************************
*/
#ifndef _VLC_H_
#define _VLC_H_
#include <bfc/platform/types.h>
//! gives CBP value from codeword number, both for intra and inter
static const byte 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}
}
};
//! for the linfo_levrun_inter routine
static const byte NTAB1[4][8][2] =
{
{{1,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{1,1},{1,2},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{2,0},{1,3},{1,4},{1,5},{0,0},{0,0},{0,0},{0,0}},
{{3,0},{2,1},{2,2},{1,6},{1,7},{1,8},{1,9},{4,0}},
};
static const byte LEVRUN1[16]=
{
4,2,2,1,1,1,1,1,1,1,0,0,0,0,0,0,
};
static const byte NTAB2[4][8][2] =
{
{{1,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{1,1},{2,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{1,2},{3,0},{4,0},{5,0},{0,0},{0,0},{0,0},{0,0}},
{{1,3},{1,4},{2,1},{3,1},{6,0},{7,0},{8,0},{9,0}},
};
//! for the linfo_levrun__c2x2 routine
static const byte LEVRUN3[4] =
{
2,1,0,0
};
static const byte NTAB3[2][2][2] =
{
{{1,0},{0,0}},
{{2,0},{1,1}},
};
extern int se_v (const char *tracestring, Bitstream *bitstream);
extern int ue_v (const char *tracestring, Bitstream *bitstream);
extern Boolean u_1 (const char *tracestring, Bitstream *bitstream);
extern int u_v (int LenInBits, const char *tracestring, Bitstream *bitstream);
extern int i_v (int LenInBits, const char *tracestring, Bitstream *bitstream);
// CAVLC mapping
extern void linfo_ue(int len, int info, int *value1, int *dummy);
extern void linfo_se(int len, int info, int *value1, int *dummy);
extern void linfo_cbp_intra_normal(int len,int info,int *cbp, int *dummy);
extern void linfo_cbp_inter_normal(int len,int info,int *cbp, int *dummy);
extern void linfo_cbp_intra_other(int len,int info,int *cbp, int *dummy);
extern void linfo_cbp_inter_other(int len,int info,int *cbp, int *dummy);
extern void linfo_levrun_inter(int len,int info,int *level,int *irun);
extern void linfo_levrun_c2x2(int len,int info,int *level,int *irun);
extern int uvlc_startcode_follows(Slice *currSlice, int dummy);
extern int readSyntaxElement_VLC (SyntaxElement *sym, Bitstream *currStream);
extern int readSyntaxElement_UVLC(SyntaxElement *, struct datapartition *);
extern int readSyntaxElement_Intra4x4PredictionMode(SyntaxElement *sym, Bitstream *currStream);
extern int GetVLCSymbol (const uint8_t buffer[],int totbitoffset,int *info, int bytecount);
extern int GetVLCSymbol_IntraMode (const uint8_t buffer[],int totbitoffset,int *info, int bytecount);
extern int readSyntaxElement_FLC (Bitstream *currStream, int numbits);
extern int readSyntaxElement_NumCoeffTrailingOnes (SyntaxElement *sym, Bitstream *currStream, int vlcnum);
extern int readSyntaxElement_NumCoeffTrailingOnesChromaDC(VideoParameters *p_Vid, SyntaxElement *sym, Bitstream *currStream);
extern int readSyntaxElement_Level_VLC0 (Bitstream *currStream);
extern int readSyntaxElement_Level_VLCN (int vlc, Bitstream *currStream);
extern int readSyntaxElement_TotalZeros (Bitstream *currStream, int vlcnum);
extern int readSyntaxElement_TotalZerosChromaDC (VideoParameters *p_Vid, Bitstream *currStream, int vlcnum);
extern int readSyntaxElement_Run (Bitstream *currStream, int vlcnum);
extern int GetBits (const uint8_t buffer[],int totbitoffset,int *info, int bitcount, int numbits);
extern int more_rbsp_data (const uint8_t buffer[],int totbitoffset,int bytecount);
int code_from_bitstream_2d_17_4_c(SyntaxElement *sym, Bitstream *currStream, const uint16_t *lentab, const uint16_t *codtab, const uint16_t *masktab);
int code_from_bitstream_2d_17_4_sse2(SyntaxElement *sym, Bitstream *currStream, const uint16_t *lentab, const uint16_t *codtab, const uint16_t *masktab);
int code_from_bitstream_2d_5_4_c(SyntaxElement *sym, Bitstream *currStream, const uint8_t *lentab, const uint8_t *codtab, const uint8_t *masktab);
int code_from_bitstream_2d_5_4_sse2(SyntaxElement *sym, Bitstream *currStream, const uint8_t *lentab, const uint8_t *codtab, const uint8_t *masktab);
int code_from_bitstream_2d_16_1_c(Bitstream *currStream, const uint16_t *lentab, const uint16_t *codtab, const uint16_t *masktab);
int code_from_bitstream_2d_16_1_sse2(Bitstream *currStream, const uint16_t *lentab, const uint16_t *codtab, const uint16_t *masktab);
#endif