Move common tables and definitions into the common library

This commit is contained in:
Martin Storsjö 2014-06-29 14:55:55 +03:00
parent 44ebe7dea4
commit 4af37a7d21
12 changed files with 415 additions and 569 deletions

View File

@ -18,6 +18,7 @@
4CC61F0918FF6B4B00E56EAB /* copy_mb_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 4CC61F0818FF6B4B00E56EAB /* copy_mb_neon.S */; };
4CE443D918B722CD0017DF25 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CE443D818B722CD0017DF25 /* Foundation.framework */; };
53C1C9BC193F0FB000404D8F /* expand_pic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53C1C9BB193F0FB000404D8F /* expand_pic.cpp */; };
5BA8F2C019603F5F00011CE4 /* common_tables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5BA8F2BF19603F5F00011CE4 /* common_tables.cpp */; };
F0B204F918FD23BF005DA23F /* copy_mb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F0B204F818FD23BF005DA23F /* copy_mb.cpp */; };
F556A8241906673900E156A8 /* arm_arch64_common_macro.S in Sources */ = {isa = PBXBuildFile; fileRef = F556A8221906673900E156A8 /* arm_arch64_common_macro.S */; };
F556A8251906673900E156A8 /* expand_picture_aarch64_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = F556A8231906673900E156A8 /* expand_picture_aarch64_neon.S */; };
@ -63,6 +64,8 @@
4CE443E918B722CD0017DF25 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
53C1C9BA193F0F9E00404D8F /* expand_pic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = expand_pic.h; sourceTree = "<group>"; };
53C1C9BB193F0FB000404D8F /* expand_pic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = expand_pic.cpp; sourceTree = "<group>"; };
5BA8F2BE19603F3500011CE4 /* wels_common_defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wels_common_defs.h; sourceTree = "<group>"; };
5BA8F2BF19603F5F00011CE4 /* common_tables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = common_tables.cpp; sourceTree = "<group>"; };
F0B204F718FD23B6005DA23F /* copy_mb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = copy_mb.h; sourceTree = "<group>"; };
F0B204F818FD23BF005DA23F /* copy_mb.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = copy_mb.cpp; sourceTree = "<group>"; };
F556A8221906673900E156A8 /* arm_arch64_common_macro.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = arm_arch64_common_macro.S; path = arm64/arm_arch64_common_macro.S; sourceTree = "<group>"; };
@ -112,6 +115,7 @@
4C3406BF18D96EA600DFA14A /* mc_common.h */,
4C3406C018D96EA600DFA14A /* measure_time.h */,
4C3406C118D96EA600DFA14A /* typedefs.h */,
5BA8F2BE19603F3500011CE4 /* wels_common_defs.h */,
4C3406C218D96EA600DFA14A /* WelsThreadLib.h */,
);
path = inc;
@ -120,6 +124,7 @@
4C3406C318D96EA600DFA14A /* src */ = {
isa = PBXGroup;
children = (
5BA8F2BF19603F5F00011CE4 /* common_tables.cpp */,
F0B204F818FD23BF005DA23F /* copy_mb.cpp */,
FAABAA1718E9354A00D4186F /* sad_common.cpp */,
4C3406C418D96EA600DFA14A /* cpu.cpp */,
@ -237,6 +242,7 @@
F5AC94FF193EB7D800F58154 /* deblocking_aarch64_neon.S in Sources */,
4C3406CE18D96EA600DFA14A /* crt_util_safe_x.cpp in Sources */,
4C3406CF18D96EA600DFA14A /* deblocking_common.cpp in Sources */,
5BA8F2C019603F5F00011CE4 /* common_tables.cpp in Sources */,
4C3406D118D96EA600DFA14A /* WelsThreadLib.cpp in Sources */,
4C3406CC18D96EA600DFA14A /* mc_neon.S in Sources */,
4C3406CB18D96EA600DFA14A /* expand_picture_neon.S in Sources */,

View File

@ -829,6 +829,10 @@
RelativePath="..\..\..\decoder\core\inc\wels_common_basis.h"
>
</File>
<File
RelativePath="..\..\..\common\inc\wels_common_defs.h"
>
</File>
<File
RelativePath="..\..\..\decoder\core\inc\wels_const.h"
>
@ -846,6 +850,10 @@
RelativePath="..\..\..\decoder\core\src\bit_stream.cpp"
>
</File>
<File
RelativePath="..\..\..\common\src\common_tables.cpp"
>
</File>
<File
RelativePath="..\..\..\common\src\copy_mb.cpp"
>

View File

@ -345,6 +345,10 @@
RelativePath="..\..\..\encoder\core\src\au_set.cpp"
>
</File>
<File
RelativePath="..\..\..\common\src\common_tables.cpp"
>
</File>
<File
RelativePath="..\..\..\common\src\copy_mb.cpp"
>
@ -710,6 +714,10 @@
RelativePath="..\..\..\encoder\core\inc\wels_common_basis.h"
>
</File>
<File
RelativePath="..\..\..\encoder\core\inc\wels_common_defs.h"
>
</File>
<File
RelativePath="..\..\..\encoder\core\inc\wels_const.h"
>

View File

@ -0,0 +1,232 @@
/*!
* \copy
* Copyright (c) 2013, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//wels_common_defs.h
#ifndef WELS_COMMON_DEFS_H__
#define WELS_COMMON_DEFS_H__
#include "typedefs.h"
#include "macros.h"
namespace WelsCommon {
/*common use table*/
extern const uint8_t g_kuiMbCountScan4Idx[24];
extern const uint8_t g_kuiCache30ScanIdx[16];
extern const uint8_t g_kuiCache48CountScan4Idx[24];
extern const ALIGNED_DECLARE (uint16_t, g_kuiDequantCoeff[52][8], 16);
extern const uint8_t g_kuiChromaQpTable[52];
/*
* NAL Unit Type (5 Bits)
*/
enum EWelsNalUnitType {
NAL_UNIT_UNSPEC_0 = 0,
NAL_UNIT_CODED_SLICE = 1,
NAL_UNIT_CODED_SLICE_DPA = 2,
NAL_UNIT_CODED_SLICE_DPB = 3,
NAL_UNIT_CODED_SLICE_DPC = 4,
NAL_UNIT_CODED_SLICE_IDR = 5,
NAL_UNIT_SEI = 6,
NAL_UNIT_SPS = 7,
NAL_UNIT_PPS = 8,
NAL_UNIT_AU_DELIMITER = 9,
NAL_UNIT_END_OF_SEQ = 10,
NAL_UNIT_END_OF_STR = 11,
NAL_UNIT_FILLER_DATA = 12,
NAL_UNIT_SPS_EXT = 13,
NAL_UNIT_PREFIX = 14,
NAL_UNIT_SUBSET_SPS = 15,
NAL_UNIT_RESV_16 = 16,
NAL_UNIT_RESV_17 = 17,
NAL_UNIT_RESV_18 = 18,
NAL_UNIT_AUX_CODED_SLICE = 19,
NAL_UNIT_CODED_SLICE_EXT = 20,
NAL_UNIT_RESV_21 = 21,
NAL_UNIT_RESV_22 = 22,
NAL_UNIT_RESV_23 = 23,
NAL_UNIT_UNSPEC_24 = 24,
NAL_UNIT_UNSPEC_25 = 25,
NAL_UNIT_UNSPEC_26 = 26,
NAL_UNIT_UNSPEC_27 = 27,
NAL_UNIT_UNSPEC_28 = 28,
NAL_UNIT_UNSPEC_29 = 29,
NAL_UNIT_UNSPEC_30 = 30,
NAL_UNIT_UNSPEC_31 = 31
};
/*
* NAL Reference IDC (2 Bits)
*/
enum EWelsNalRefIdc {
NRI_PRI_LOWEST = 0,
NRI_PRI_LOW = 1,
NRI_PRI_HIGH = 2,
NRI_PRI_HIGHEST = 3
};
/*
* VCL TYPE
*/
enum EVclType {
NON_VCL = 0,
VCL = 1,
NOT_APP = 2
};
/*
* vcl type map for given NAL unit type and corresponding H264 type (0: AVC; 1: SVC).
*/
extern const EVclType g_keTypeMap[32][2];
#define IS_VCL_NAL(t, ext_idx) (g_keTypeMap[t][ext_idx] == VCL)
#define IS_PARAM_SETS_NALS(t) ( (t) == NAL_UNIT_SPS || (t) == NAL_UNIT_PPS || (t) == NAL_UNIT_SUBSET_SPS )
#define IS_SPS_NAL(t) ( (t) == NAL_UNIT_SPS )
#define IS_SUBSET_SPS_NAL(t) ( (t) == NAL_UNIT_SUBSET_SPS )
#define IS_PPS_NAL(t) ( (t) == NAL_UNIT_PPS )
#define IS_SEI_NAL(t) ( (t) == NAL_UNIT_SEI )
#define IS_PREFIX_NAL(t) ( (t) == NAL_UNIT_PREFIX )
#define IS_SUBSET_SPS_USED(t) ( (t) == NAL_UNIT_SUBSET_SPS || (t) == NAL_UNIT_CODED_SLICE_EXT )
#define IS_VCL_NAL_AVC_BASE(t) ( (t) == NAL_UNIT_CODED_SLICE || (t) == NAL_UNIT_CODED_SLICE_IDR )
#define IS_NEW_INTRODUCED_SVC_NAL(t) ( (t) == NAL_UNIT_PREFIX || (t) == NAL_UNIT_CODED_SLICE_EXT )
/* Base SSlice Types
* Invalid in case of eSliceType exceeds 9,
* Need trim when eSliceType > 4 as fixed SliceType(eSliceType-4),
* meaning mapped version after eSliceType minus 4.
*/
enum EWelsSliceType {
P_SLICE = 0,
B_SLICE = 1,
I_SLICE = 2,
SP_SLICE = 3,
SI_SLICE = 4,
UNKNOWN_SLICE = 5
};
/* SSlice Types in scalable extension */ ;
enum ESliceTypeExt {
EP_SLICE = 0, // EP_SLICE: 0, 5
EB_SLICE = 1, // EB_SLICE: 1, 6
EI_SLICE = 2 // EI_SLICE: 2, 7
};
/* List Index */
enum EListIndex {
LIST_0 = 0,
LIST_1 = 1,
LIST_A = 2
};
/* Motion Vector components */
enum EMvComp {
MV_X = 0,
MV_Y = 1,
MV_A = 2
};
/* Chroma Components */
enum EChromaComp {
CHROMA_CB = 0,
CHROMA_CR = 1,
CHROMA_A = 2
};
/*
* Memory Management Control Operation (MMCO) code
*/
enum EMmcoCode {
MMCO_END = 0,
MMCO_SHORT2UNUSED = 1,
MMCO_LONG2UNUSED = 2,
MMCO_SHORT2LONG = 3,
MMCO_SET_MAX_LONG = 4,
MMCO_RESET = 5,
MMCO_LONG = 6
};
/////////intra16x16 Luma
#define I16_PRED_INVALID -1
#define I16_PRED_V 0
#define I16_PRED_H 1
#define I16_PRED_DC 2
#define I16_PRED_P 3
#define I16_PRED_DC_L 4
#define I16_PRED_DC_T 5
#define I16_PRED_DC_128 6
#define I16_PRED_DC_A 7
//////////intra4x4 Luma
#define I4_PRED_INVALID 0
#define I4_PRED_V 0
#define I4_PRED_H 1
#define I4_PRED_DC 2
#define I4_PRED_DDL 3 //diagonal_down_left
#define I4_PRED_DDR 4 //diagonal_down_right
#define I4_PRED_VR 5 //vertical_right
#define I4_PRED_HD 6 //horizon_down
#define I4_PRED_VL 7 //vertical_left
#define I4_PRED_HU 8 //horizon_up
#define I4_PRED_DC_L 9
#define I4_PRED_DC_T 10
#define I4_PRED_DC_128 11
#define I4_PRED_DDL_TOP 12 //right-top replacing by padding rightmost pixel of top
#define I4_PRED_VL_TOP 13 //right-top replacing by padding rightmost pixel of top
#define I4_PRED_A 14
//////////intra Chroma
#define C_PRED_INVALID -1
#define C_PRED_DC 0
#define C_PRED_H 1
#define C_PRED_V 2
#define C_PRED_P 3
#define C_PRED_DC_L 4
#define C_PRED_DC_T 5
#define C_PRED_DC_128 6
#define C_PRED_A 7
}
#endif//WELS_COMMON_DEFS_H__

View File

@ -0,0 +1,153 @@
/*!
* \copy
* Copyright (c) 2013, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "wels_common_defs.h"
namespace WelsCommon {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////pNonZeroCount[16+8] mapping scan index
const uint8_t g_kuiMbCountScan4Idx[24] = {
// 0 1 | 4 5 luma 8*8 block pNonZeroCount[16+8]
0, 1, 4, 5, // 2 3 | 6 7 0 | 1 0 1 2 3
2, 3, 6, 7, //--------------- --------- 4 5 6 7
8, 9, 12, 13, // 8 9 | 12 13 2 | 3 8 9 10 11
10, 11, 14, 15, // 10 11 | 14 15-----------------------------> 12 13 14 15
16, 17, 20, 21, //---------------- chroma 8*8 block 16 17 18 19
18, 19, 22, 23 // 16 17 | 20 21 0 1 20 21 22 23
};
const uint8_t g_kuiCache48CountScan4Idx[24] = {
/* Luma */
9, 10, 17, 18, // 1+1*8, 2+1*8, 1+2*8, 2+2*8,
11, 12, 19, 20, // 3+1*8, 4+1*8, 3+2*8, 4+2*8,
25, 26, 33, 34, // 1+3*8, 2+3*8, 1+4*8, 2+4*8,
27, 28, 35, 36, // 3+3*8, 4+3*8, 3+4*8, 4+4*8,
/* Cb */
14, 15, // 6+1*8, 7+1*8,
22, 23, // 6+2*8, 7+2*8,
/* Cr */
38, 39, // 6+4*8, 7+4*8,
46, 47, // 6+5*8, 7+5*8,
};
//cache element equal to 30
const uint8_t g_kuiCache30ScanIdx[16] = { //mv or uiRefIndex cache scan index, 4*4 block as basic unit
7, 8, 13, 14,
9, 10, 15, 16,
19, 20, 25, 26,
21, 22, 27, 28
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// extern at wels_common_defs.h
const uint8_t g_kuiChromaQpTable[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
};
/*
* vcl type map for given NAL unit type and corresponding H264 type (0: AVC; 1: SVC).
*/
const EVclType g_keTypeMap[32][2] = {
{ NON_VCL, NON_VCL }, // 0: NAL_UNIT_UNSPEC_0
{ VCL, VCL, }, // 1: NAL_UNIT_CODED_SLICE
{ VCL, NOT_APP }, // 2: NAL_UNIT_CODED_SLICE_DPA
{ VCL, NOT_APP }, // 3: NAL_UNIT_CODED_SLICE_DPB
{ VCL, NOT_APP }, // 4: NAL_UNIT_CODED_SLICE_DPC
{ VCL, VCL }, // 5: NAL_UNIT_CODED_SLICE_IDR
{ NON_VCL, NON_VCL }, // 6: NAL_UNIT_SEI
{ NON_VCL, NON_VCL }, // 7: NAL_UNIT_SPS
{ NON_VCL, NON_VCL }, // 8: NAL_UNIT_PPS
{ NON_VCL, NON_VCL }, // 9: NAL_UNIT_AU_DELIMITER
{ NON_VCL, NON_VCL }, // 10: NAL_UNIT_END_OF_SEQ
{ NON_VCL, NON_VCL }, // 11: NAL_UNIT_END_OF_STR
{ NON_VCL, NON_VCL }, // 12: NAL_UNIT_FILLER_DATA
{ NON_VCL, NON_VCL }, // 13: NAL_UNIT_SPS_EXT
{ NON_VCL, NON_VCL }, // 14: NAL_UNIT_PREFIX, NEED associate succeeded NAL to make a VCL
{ NON_VCL, NON_VCL }, // 15: NAL_UNIT_SUBSET_SPS
{ NON_VCL, NON_VCL }, // 16: NAL_UNIT_RESV_16
{ NON_VCL, NON_VCL }, // 17: NAL_UNIT_RESV_17
{ NON_VCL, NON_VCL }, // 18: NAL_UNIT_RESV_18
{ NON_VCL, NON_VCL }, // 19: NAL_UNIT_AUX_CODED_SLICE
{ NON_VCL, VCL }, // 20: NAL_UNIT_CODED_SLICE_EXT
{ NON_VCL, NON_VCL }, // 21: NAL_UNIT_RESV_21
{ NON_VCL, NON_VCL }, // 22: NAL_UNIT_RESV_22
{ NON_VCL, NON_VCL }, // 23: NAL_UNIT_RESV_23
{ NON_VCL, NON_VCL }, // 24: NAL_UNIT_UNSPEC_24
{ NON_VCL, NON_VCL }, // 25: NAL_UNIT_UNSPEC_25
{ NON_VCL, NON_VCL }, // 26: NAL_UNIT_UNSPEC_26
{ NON_VCL, NON_VCL }, // 27: NAL_UNIT_UNSPEC_27
{ NON_VCL, NON_VCL }, // 28: NAL_UNIT_UNSPEC_28
{ NON_VCL, NON_VCL }, // 29: NAL_UNIT_UNSPEC_29
{ NON_VCL, NON_VCL }, // 30: NAL_UNIT_UNSPEC_30
{ NON_VCL, NON_VCL } // 31: NAL_UNIT_UNSPEC_31
};
ALIGNED_DECLARE (const uint16_t, g_kuiDequantCoeff[52][8], 16) = {
/* 0*/{ 10, 13, 10, 13, 13, 16, 13, 16 }, /* 1*/{ 11, 14, 11, 14, 14, 18, 14, 18 },
/* 2*/{ 13, 16, 13, 16, 16, 20, 16, 20 }, /* 3*/{ 14, 18, 14, 18, 18, 23, 18, 23 },
/* 4*/{ 16, 20, 16, 20, 20, 25, 20, 25 }, /* 5*/{ 18, 23, 18, 23, 23, 29, 23, 29 },
/* 6*/{ 20, 26, 20, 26, 26, 32, 26, 32 }, /* 7*/{ 22, 28, 22, 28, 28, 36, 28, 36 },
/* 8*/{ 26, 32, 26, 32, 32, 40, 32, 40 }, /* 9*/{ 28, 36, 28, 36, 36, 46, 36, 46 },
/*10*/{ 32, 40, 32, 40, 40, 50, 40, 50 }, /*11*/{ 36, 46, 36, 46, 46, 58, 46, 58 },
/*12*/{ 40, 52, 40, 52, 52, 64, 52, 64 }, /*13*/{ 44, 56, 44, 56, 56, 72, 56, 72 },
/*14*/{ 52, 64, 52, 64, 64, 80, 64, 80 }, /*15*/{ 56, 72, 56, 72, 72, 92, 72, 92 },
/*16*/{ 64, 80, 64, 80, 80, 100, 80, 100 }, /*17*/{ 72, 92, 72, 92, 92, 116, 92, 116 },
/*18*/{ 80, 104, 80, 104, 104, 128, 104, 128 }, /*19*/{ 88, 112, 88, 112, 112, 144, 112, 144 },
/*20*/{ 104, 128, 104, 128, 128, 160, 128, 160 }, /*21*/{ 112, 144, 112, 144, 144, 184, 144, 184 },
/*22*/{ 128, 160, 128, 160, 160, 200, 160, 200 }, /*23*/{ 144, 184, 144, 184, 184, 232, 184, 232 },
/*24*/{ 160, 208, 160, 208, 208, 256, 208, 256 }, /*25*/{ 176, 224, 176, 224, 224, 288, 224, 288 },
/*26*/{ 208, 256, 208, 256, 256, 320, 256, 320 }, /*27*/{ 224, 288, 224, 288, 288, 368, 288, 368 },
/*28*/{ 256, 320, 256, 320, 320, 400, 320, 400 }, /*29*/{ 288, 368, 288, 368, 368, 464, 368, 464 },
/*30*/{ 320, 416, 320, 416, 416, 512, 416, 512 }, /*31*/{ 352, 448, 352, 448, 448, 576, 448, 576 },
/*32*/{ 416, 512, 416, 512, 512, 640, 512, 640 }, /*33*/{ 448, 576, 448, 576, 576, 736, 576, 736 },
/*34*/{ 512, 640, 512, 640, 640, 800, 640, 800 }, /*35*/{ 576, 736, 576, 736, 736, 928, 736, 928 },
/*36*/{ 640, 832, 640, 832, 832, 1024, 832, 1024 }, /*37*/{ 704, 896, 704, 896, 896, 1152, 896, 1152 },
/*38*/{ 832, 1024, 832, 1024, 1024, 1280, 1024, 1280 }, /*39*/{ 896, 1152, 896, 1152, 1152, 1472, 1152, 1472 },
/*40*/{ 1024, 1280, 1024, 1280, 1280, 1600, 1280, 1600 }, /*41*/{ 1152, 1472, 1152, 1472, 1472, 1856, 1472, 1856 },
/*42*/{ 1280, 1664, 1280, 1664, 1664, 2048, 1664, 2048 }, /*43*/{ 1408, 1792, 1408, 1792, 1792, 2304, 1792, 2304 },
/*44*/{ 1664, 2048, 1664, 2048, 2048, 2560, 2048, 2560 }, /*45*/{ 1792, 2304, 1792, 2304, 2304, 2944, 2304, 2944 },
/*46*/{ 2048, 2560, 2048, 2560, 2560, 3200, 2560, 3200 }, /*47*/{ 2304, 2944, 2304, 2944, 2944, 3712, 2944, 3712 },
/*48*/{ 2560, 3328, 2560, 3328, 3328, 4096, 3328, 4096 }, /*49*/{ 2816, 3584, 2816, 3584, 3584, 4608, 3584, 4608 },
/*50*/{ 3328, 4096, 3328, 4096, 4096, 5120, 4096, 5120 }, /*51*/{ 3584, 4608, 3584, 4608, 4608, 5888, 4608, 5888 },
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

View File

@ -1,5 +1,6 @@
COMMON_SRCDIR=codec/common
COMMON_CPP_SRCS=\
$(COMMON_SRCDIR)/src/common_tables.cpp\
$(COMMON_SRCDIR)/src/copy_mb.cpp\
$(COMMON_SRCDIR)/src/cpu.cpp\
$(COMMON_SRCDIR)/src/crt_util_safe_x.cpp\

View File

@ -57,11 +57,6 @@ namespace WelsDec {
////////////////////////mapping scan index////////////////////////
// for data sharing cross modules and try to reduce size of binary generated
extern const uint8_t g_kuiMbCountScan4Idx[24];
extern const uint8_t g_kuiCache30ScanIdx[16];
extern const uint8_t g_kuiCache48CountScan4Idx[24];
extern const uint8_t g_kuiScan4[16];
typedef struct TagNeighborAvail {

View File

@ -37,17 +37,16 @@
#include "typedefs.h"
#include "macros.h"
#include "wels_common_defs.h"
using namespace WelsCommon;
namespace WelsDec {
// for data sharing cross modules and try to reduce size of binary generated
extern const uint8_t g_kuiChromaQpTable[52];
/*common use table*/
extern const uint8_t g_kuiScan8[24];
extern const uint8_t g_kuiLumaDcZigzagScan[16];
extern const uint8_t g_kuiChromaDcScan[4];
extern ALIGNED_DECLARE (const uint16_t, g_kuiDequantCoeff[52][8], 16);
/* Profile IDC */
typedef uint8_t ProfileIdc;
enum {
@ -64,125 +63,12 @@ PRO_SCALABLE_BASELINE = 83,
PRO_SCALABLE_HIGH = 86,
};
/*
* NAL Unit Type (5 Bits)
*/
typedef enum TagNalUnitType {
NAL_UNIT_UNSPEC_0 = 0,
NAL_UNIT_CODED_SLICE = 1,
NAL_UNIT_CODED_SLICE_DPA = 2,
NAL_UNIT_CODED_SLICE_DPB = 3,
NAL_UNIT_CODED_SLICE_DPC = 4,
NAL_UNIT_CODED_SLICE_IDR = 5,
NAL_UNIT_SEI = 6,
NAL_UNIT_SPS = 7,
NAL_UNIT_PPS = 8,
NAL_UNIT_AU_DELIMITER = 9,
NAL_UNIT_END_OF_SEQ = 10,
NAL_UNIT_END_OF_STR = 11,
NAL_UNIT_FILLER_DATA = 12,
NAL_UNIT_SPS_EXT = 13,
NAL_UNIT_PREFIX = 14,
NAL_UNIT_SUBSET_SPS = 15,
NAL_UNIT_RESV_16 = 16,
NAL_UNIT_RESV_17 = 17,
NAL_UNIT_RESV_18 = 18,
NAL_UNIT_AUX_CODED_SLICE = 19,
NAL_UNIT_CODED_SLICE_EXT = 20,
NAL_UNIT_RESV_21 = 21,
NAL_UNIT_RESV_22 = 22,
NAL_UNIT_RESV_23 = 23,
NAL_UNIT_UNSPEC_24 = 24,
NAL_UNIT_UNSPEC_25 = 25,
NAL_UNIT_UNSPEC_26 = 26,
NAL_UNIT_UNSPEC_27 = 27,
NAL_UNIT_UNSPEC_28 = 28,
NAL_UNIT_UNSPEC_29 = 29,
NAL_UNIT_UNSPEC_30 = 30,
NAL_UNIT_UNSPEC_31 = 31
} EWelsNalUnitType;
/*
* NAL Reference IDC (2 Bits)
*/
typedef uint8_t NalRefIdc;
enum {
NRI_PRI_LOWEST = 0,
NRI_PRI_LOW = 1,
NRI_PRI_HIGH = 2,
NRI_PRI_HIGHEST = 3
};
/*
* VCL TYPE
*/
typedef uint8_t VclType;
enum {
NON_VCL = 0,
VCL = 1,
NOT_APP = 2
};
/*
* vcl type map for given NAL unit type and corresponding H264 type
*/
extern const VclType g_kuiVclTypeMap[32][2];
#define IS_VCL_NAL(t, ext_idx) (g_kuiVclTypeMap[t][ext_idx] == VCL)
#define IS_PARAM_SETS_NALS(t) ( (t) == NAL_UNIT_SPS || (t) == NAL_UNIT_PPS || (t) == NAL_UNIT_SUBSET_SPS )
#define IS_SPS_NAL(t) ( (t) == NAL_UNIT_SPS )
#define IS_SUBSET_SPS_NAL(t) ( (t) == NAL_UNIT_SUBSET_SPS )
#define IS_PPS_NAL(t) ( (t) == NAL_UNIT_PPS )
#define IS_SEI_NAL(t) ( (t) == NAL_UNIT_SEI )
#define IS_PREFIX_NAL(t) ( (t) == NAL_UNIT_PREFIX )
#define IS_SUBSET_SPS_USED(t) ( (t) == NAL_UNIT_SUBSET_SPS || (t) == NAL_UNIT_CODED_SLICE_EXT )
#define IS_VCL_NAL_AVC_BASE(t) ( (t) == NAL_UNIT_CODED_SLICE || (t) == NAL_UNIT_CODED_SLICE_IDR )
#define IS_NEW_INTRODUCED_SVC_NAL(t) ( (t) == NAL_UNIT_PREFIX || (t) == NAL_UNIT_CODED_SLICE_EXT )
/* Base Slice Types
* Invalid in case of eSliceType exceeds 9,
* Need trim when eSliceType > 4 as fixed SliceType(eSliceType-4),
* meaning mapped version after eSliceType minus 4.
*/
typedef enum TagSliceType {
P_SLICE = 0,
B_SLICE = 1,
I_SLICE = 2,
SP_SLICE = 3,
SI_SLICE = 4,
UNKNOWN_SLICE = 5
} EWelsSliceType;
/* List Index */
typedef uint8_t ListIndex;
enum {
LIST_0 = 0,
LIST_1 = 1,
LIST_A = 2
};
/* Picture Size */
typedef struct TagPictureSize {
int32_t iWidth;
int32_t iHeight;
} SPictureSize;
/* Motion Vector components */
typedef uint8_t MvComp;
enum {
MV_X = 0,
MV_Y = 1,
MV_A = 2
};
/* Chroma Components */
typedef uint8_t ChromaComp;
enum {
CHROMA_CB = 0,
CHROMA_CR = 1,
CHROMA_A = 2
};
/* Position Offset structure */
typedef struct TagPosOffset {
@ -232,55 +118,7 @@ typedef int32_t SubMbType;
#define IS_I_BL(type) ( (type) == MB_TYPE_INTRA_BL )
#define IS_SUB8x8(type) (MB_TYPE_8x8 == (type) || MB_TYPE_8x8_REF0 == (type))
/*
* Memory Management Control Operation (MMCO) code
*/
enum {
MMCO_END = 0,
MMCO_SHORT2UNUSED = 1,
MMCO_LONG2UNUSED = 2,
MMCO_SHORT2LONG = 3,
MMCO_SET_MAX_LONG = 4,
MMCO_RESET = 5,
MMCO_LONG = 6
};
/////////intra16x16 Luma
#define I16_PRED_V 0
#define I16_PRED_H 1
#define I16_PRED_DC 2
#define I16_PRED_P 3
#define I16_PRED_DC_L 4
#define I16_PRED_DC_T 5
#define I16_PRED_DC_128 6
//////////intra4x4 Luma
#define I4_PRED_V 0
#define I4_PRED_H 1
#define I4_PRED_DC 2
#define I4_PRED_DDL 3 //diagonal_down_left
#define I4_PRED_DDR 4 //diagonal_down_right
#define I4_PRED_VR 5 //vertical_right
#define I4_PRED_HD 6 //horizon_down
#define I4_PRED_VL 7 //vertical_left
#define I4_PRED_HU 8 //horizon_up
#define I4_PRED_DC_L 9
#define I4_PRED_DC_T 10
#define I4_PRED_DC_128 11
#define I4_PRED_DDL_TOP 12 //right-top replacing by padding rightmost pixel of top
#define I4_PRED_VL_TOP 13 //right-top replacing by padding rightmost pixel of top
//////////intra Chroma
#define C_PRED_DC 0
#define C_PRED_H 1
#define C_PRED_V 2
#define C_PRED_P 3
#define C_PRED_DC_L 4
#define C_PRED_DC_T 5
#define C_PRED_DC_128 6
} // namespace WelsDec

View File

@ -40,40 +40,6 @@ namespace WelsDec {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////non_zero_count[16+8] mapping scan index
const uint8_t g_kuiMbCountScan4Idx[24] = {
// 0 1 | 4 5 luma 8*8 block non_zero_count[16+8]
0, 1, 4, 5, // 2 3 | 6 7 0 | 1 0 1 2 3
2, 3, 6, 7, //--------------- --------- 4 5 6 7
8, 9, 12, 13, // 8 9 | 12 13 2 | 3 8 9 10 11
10, 11, 14, 15, // 10 11 | 14 15-----------------------------> 12 13 14 15
16, 17, 20, 21, //---------------- chroma 8*8 block 16 17 18 19
18, 19, 22, 23 // 16 17 | 20 21 0 1 20 21 22 23
};
//cache element equal to 26
const uint8_t g_kuiCache48CountScan4Idx[24] = {
/* Luma */
9, 10, 17, 18, // 1+1*8, 2+1*8, 1+2*8, 2+2*8,
11, 12, 19, 20, // 3+1*8, 4+1*8, 3+2*8, 4+2*8,
25, 26, 33, 34, // 1+3*8, 2+3*8, 1+4*8, 2+4*8,
27, 28, 35, 36, // 3+3*8, 4+3*8, 3+4*8, 4+4*8,
/* Cb */
14, 15, // 6+1*8, 7+1*8,
22, 23, // 6+2*8, 7+2*8,
/* Cr */
38, 39, // 6+4*8, 7+4*8,
46, 47, // 6+5*8, 7+5*8,
};
//cache element equal to 30
const uint8_t g_kuiCache30ScanIdx[16] = { //mv or ref_index cache scan index, 4*4 block as basic unit
7, 8, 13, 14,
9, 10, 15, 16,
19, 20, 25, 26,
21, 22, 27, 28
};
const uint8_t g_kuiScan4[16] = { //for mb cache in sMb (only current element, without neighbor)
// 4*4block scan mb cache order
@ -87,51 +53,6 @@ const uint8_t g_kuiScan4[16] = { //for mb cache in sMb (only current element, wi
// extern at wels_common_basis.h
const uint8_t g_kuiChromaQpTable[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
};
/*
* vcl type map for given NAL unit type and corresponding H264 type
*/
const VclType g_kuiVclTypeMap[32][2] = {
{ NON_VCL, NON_VCL }, // 0: NAL_UNIT_UNSPEC_0
{ VCL, VCL, }, // 1: NAL_UNIT_CODED_SLICE
{ VCL, NOT_APP }, // 2: NAL_UNIT_CODED_SLICE_DPA
{ VCL, NOT_APP }, // 3: NAL_UNIT_CODED_SLICE_DPB
{ VCL, NOT_APP }, // 4: NAL_UNIT_CODED_SLICE_DPC
{ VCL, VCL }, // 5: NAL_UNIT_CODED_SLICE_IDR
{ NON_VCL, NON_VCL }, // 6: NAL_UNIT_SEI
{ NON_VCL, NON_VCL }, // 7: NAL_UNIT_SPS
{ NON_VCL, NON_VCL }, // 8: NAL_UNIT_PPS
{ NON_VCL, NON_VCL }, // 9: NAL_UNIT_AU_DELIMITER
{ NON_VCL, NON_VCL }, // 10: NAL_UNIT_END_OF_SEQ
{ NON_VCL, NON_VCL }, // 11: NAL_UNIT_END_OF_STR
{ NON_VCL, NON_VCL }, // 12: NAL_UNIT_FILLER_DATA
{ NON_VCL, NON_VCL }, // 13: NAL_UNIT_SPS_EXT
{ NON_VCL, NON_VCL }, // 14: NAL_UNIT_PREFIX, NEED associate succeeded NAL to make a VCL
{ NON_VCL, NON_VCL }, // 15: NAL_UNIT_SUBSET_SPS
{ NON_VCL, NON_VCL }, // 16: NAL_UNIT_RESV_16
{ NON_VCL, NON_VCL }, // 17: NAL_UNIT_RESV_17
{ NON_VCL, NON_VCL }, // 18: NAL_UNIT_RESV_18
{ NON_VCL, NON_VCL }, // 19: NAL_UNIT_AUX_CODED_SLICE
{ NON_VCL, VCL }, // 20: NAL_UNIT_CODED_SLICE_EXT
{ NON_VCL, NON_VCL }, // 21: NAL_UNIT_RESV_21
{ NON_VCL, NON_VCL }, // 22: NAL_UNIT_RESV_22
{ NON_VCL, NON_VCL }, // 23: NAL_UNIT_RESV_23
{ NON_VCL, NON_VCL }, // 24: NAL_UNIT_UNSPEC_24
{ NON_VCL, NON_VCL }, // 25: NAL_UNIT_UNSPEC_25
{ NON_VCL, NON_VCL }, // 26: NAL_UNIT_UNSPEC_26
{ NON_VCL, NON_VCL }, // 27: NAL_UNIT_UNSPEC_27
{ NON_VCL, NON_VCL }, // 28: NAL_UNIT_UNSPEC_28
{ NON_VCL, NON_VCL }, // 29: NAL_UNIT_UNSPEC_29
{ NON_VCL, NON_VCL }, // 30: NAL_UNIT_UNSPEC_30
{ NON_VCL, NON_VCL } // 31: NAL_UNIT_UNSPEC_31
};
/*common use table*/
const uint8_t g_kuiScan8[24] = { // [16 + 2*4]
9, 10, 17, 18, // 1+1*8, 2+1*8, 1+2*8, 2+2*8,
@ -155,35 +76,6 @@ const uint8_t g_kuiChromaDcScan[4] = {
0, 16, 32, 48
};
ALIGNED_DECLARE (const uint16_t, g_kuiDequantCoeff[52][8], 16) = {
/* 0*/{ 10, 13, 10, 13, 13, 16, 13, 16 }, /* 1*/{ 11, 14, 11, 14, 14, 18, 14, 18 },
/* 2*/{ 13, 16, 13, 16, 16, 20, 16, 20 }, /* 3*/{ 14, 18, 14, 18, 18, 23, 18, 23 },
/* 4*/{ 16, 20, 16, 20, 20, 25, 20, 25 }, /* 5*/{ 18, 23, 18, 23, 23, 29, 23, 29 },
/* 6*/{ 20, 26, 20, 26, 26, 32, 26, 32 }, /* 7*/{ 22, 28, 22, 28, 28, 36, 28, 36 },
/* 8*/{ 26, 32, 26, 32, 32, 40, 32, 40 }, /* 9*/{ 28, 36, 28, 36, 36, 46, 36, 46 },
/*10*/{ 32, 40, 32, 40, 40, 50, 40, 50 }, /*11*/{ 36, 46, 36, 46, 46, 58, 46, 58 },
/*12*/{ 40, 52, 40, 52, 52, 64, 52, 64 }, /*13*/{ 44, 56, 44, 56, 56, 72, 56, 72 },
/*14*/{ 52, 64, 52, 64, 64, 80, 64, 80 }, /*15*/{ 56, 72, 56, 72, 72, 92, 72, 92 },
/*16*/{ 64, 80, 64, 80, 80, 100, 80, 100 }, /*17*/{ 72, 92, 72, 92, 92, 116, 92, 116 },
/*18*/{ 80, 104, 80, 104, 104, 128, 104, 128 }, /*19*/{ 88, 112, 88, 112, 112, 144, 112, 144 },
/*20*/{ 104, 128, 104, 128, 128, 160, 128, 160 }, /*21*/{ 112, 144, 112, 144, 144, 184, 144, 184 },
/*22*/{ 128, 160, 128, 160, 160, 200, 160, 200 }, /*23*/{ 144, 184, 144, 184, 184, 232, 184, 232 },
/*24*/{ 160, 208, 160, 208, 208, 256, 208, 256 }, /*25*/{ 176, 224, 176, 224, 224, 288, 224, 288 },
/*26*/{ 208, 256, 208, 256, 256, 320, 256, 320 }, /*27*/{ 224, 288, 224, 288, 288, 368, 288, 368 },
/*28*/{ 256, 320, 256, 320, 320, 400, 320, 400 }, /*29*/{ 288, 368, 288, 368, 368, 464, 368, 464 },
/*30*/{ 320, 416, 320, 416, 416, 512, 416, 512 }, /*31*/{ 352, 448, 352, 448, 448, 576, 448, 576 },
/*32*/{ 416, 512, 416, 512, 512, 640, 512, 640 }, /*33*/{ 448, 576, 448, 576, 576, 736, 576, 736 },
/*34*/{ 512, 640, 512, 640, 640, 800, 640, 800 }, /*35*/{ 576, 736, 576, 736, 736, 928, 736, 928 },
/*36*/{ 640, 832, 640, 832, 832, 1024, 832, 1024 }, /*37*/{ 704, 896, 704, 896, 896, 1152, 896, 1152 },
/*38*/{ 832, 1024, 832, 1024, 1024, 1280, 1024, 1280 }, /*39*/{ 896, 1152, 896, 1152, 1152, 1472, 1152, 1472 },
/*40*/{ 1024, 1280, 1024, 1280, 1280, 1600, 1280, 1600 }, /*41*/{ 1152, 1472, 1152, 1472, 1472, 1856, 1472, 1856 },
/*42*/{ 1280, 1664, 1280, 1664, 1664, 2048, 1664, 2048 }, /*43*/{ 1408, 1792, 1408, 1792, 1792, 2304, 1792, 2304 },
/*44*/{ 1664, 2048, 1664, 2048, 2048, 2560, 2048, 2560 }, /*45*/{ 1792, 2304, 1792, 2304, 2304, 2944, 2304, 2944 },
/*46*/{ 2048, 2560, 2048, 2560, 2560, 3200, 2560, 3200 }, /*47*/{ 2304, 2944, 2304, 2944, 2944, 3712, 2944, 3712 },
/*48*/{ 2560, 3328, 2560, 3328, 3328, 4096, 3328, 4096 }, /*49*/{ 2816, 3584, 2816, 3584, 3584, 4608, 3584, 4608 },
/*50*/{ 3328, 4096, 3328, 4096, 4096, 5120, 4096, 5120 }, /*51*/{ 3584, 4608, 3584, 4608, 4608, 5888, 4608, 5888 },
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const uint8_t g_kuiIntra4x4CbpTable[48] = {

View File

@ -58,10 +58,7 @@ namespace WelsSVCEnc {
////////////////////////mapping scan index////////////////////////
extern const uint8_t g_kuiSmb4AddrIn256[16];
extern const uint8_t g_kuiMbCountScan4Idx[24];
extern const uint8_t g_kuiCache30ScanIdx[16];
extern const uint8_t g_kuiCache12_8x8RefIdx[4];
extern const uint8_t g_kuiCache48CountScan4Idx[24];
typedef struct TagDCTCoeff {
//ALIGNED_DECLARE( int16_t, residual_ac[16], 16 ); //I_16x16

View File

@ -39,117 +39,11 @@
#include "wels_const.h"
#include "wels_common_defs.h"
using namespace WelsCommon;
namespace WelsSVCEnc {
/*common use table*/
extern const ALIGNED_DECLARE (uint16_t, g_kuiDequantCoeff[52][8], 16);
extern const uint8_t g_kuiChromaQpTable[52];
/*
* NAL Unit Type (5 Bits)
*/
enum EWelsNalUnitType {
NAL_UNIT_UNSPEC_0 = 0,
NAL_UNIT_CODED_SLICE = 1,
NAL_UNIT_CODED_SLICE_DPA = 2,
NAL_UNIT_CODED_SLICE_DPB = 3,
NAL_UNIT_CODED_SLICE_DPC = 4,
NAL_UNIT_CODED_SLICE_IDR = 5,
NAL_UNIT_SEI = 6,
NAL_UNIT_SPS = 7,
NAL_UNIT_PPS = 8,
NAL_UNIT_AU_DELIMITER = 9,
NAL_UNIT_END_OF_SEQ = 10,
NAL_UNIT_END_OF_STR = 11,
NAL_UNIT_FILLER_DATA = 12,
NAL_UNIT_SPS_EXT = 13,
NAL_UNIT_PREFIX = 14,
NAL_UNIT_SUBSET_SPS = 15,
NAL_UNIT_RESV_16 = 16,
NAL_UNIT_RESV_17 = 17,
NAL_UNIT_RESV_18 = 18,
NAL_UNIT_AUX_CODED_SLICE = 19,
NAL_UNIT_CODED_SLICE_EXT = 20,
NAL_UNIT_RESV_21 = 21,
NAL_UNIT_RESV_22 = 22,
NAL_UNIT_RESV_23 = 23,
NAL_UNIT_UNSPEC_24 = 24,
NAL_UNIT_UNSPEC_25 = 25,
NAL_UNIT_UNSPEC_26 = 26,
NAL_UNIT_UNSPEC_27 = 27,
NAL_UNIT_UNSPEC_28 = 28,
NAL_UNIT_UNSPEC_29 = 29,
NAL_UNIT_UNSPEC_30 = 30,
NAL_UNIT_UNSPEC_31 = 31
};
/*
* NAL Reference IDC (2 Bits)
*/
enum EWelsNalRefIdc {
NRI_PRI_LOWEST = 0,
NRI_PRI_LOW = 1,
NRI_PRI_HIGH = 2,
NRI_PRI_HIGHEST = 3
};
/*
* VCL TYPE
*/
enum EVclType {
NON_VCL = 0,
VCL = 1,
NOT_APP = 2
};
/*
* vcl type map for given NAL unit type and corresponding H264 type (0: AVC; 1: SVC).
*/
extern const EVclType g_keTypeMap[32][2];
#define IS_VCL_NAL(t, ext_idx) (g_keTypeMap[t][ext_idx] == VCL)
#define IS_PARAM_SETS_NALS(t) ( (t) == NAL_UNIT_SPS || (t) == NAL_UNIT_PPS || (t) == NAL_UNIT_SUBSET_SPS )
#define IS_SPS_NAL(t) ( (t) == NAL_UNIT_SPS )
#define IS_SUBSET_SPS_NAL(t) ( (t) == NAL_UNIT_SUBSET_SPS )
#define IS_PPS_NAL(t) ( (t) == NAL_UNIT_PPS )
#define IS_SEI_NAL(t) ( (t) == NAL_UNIT_SEI )
#define IS_PREFIX_NAL(t) ( (t) == NAL_UNIT_PREFIX )
#define IS_SUBSET_SPS_USED(t) ( (t) == NAL_UNIT_SUBSET_SPS || (t) == NAL_UNIT_CODED_SLICE_EXT )
#define IS_VCL_NAL_AVC_BASE(t) ( (t) == NAL_UNIT_CODED_SLICE || (t) == NAL_UNIT_CODED_SLICE_IDR )
#define IS_NEW_INTRODUCED_SVC_NAL(t) ( (t) == NAL_UNIT_PREFIX || (t) == NAL_UNIT_CODED_SLICE_EXT )
/* Base SSlice Types
* Invalid in case of eSliceType exceeds 9,
* Need trim when eSliceType > 4 as fixed SliceType(eSliceType-4),
* meaning mapped version after eSliceType minus 4.
*/
enum EWelsSliceType {
P_SLICE = 0,
B_SLICE = 1,
I_SLICE = 2,
SP_SLICE = 3,
SI_SLICE = 4,
UNKNOWN_SLICE = 5
};
/* SSlice Types in scalable extension */ ;
enum ESliceTypeExt {
EP_SLICE = 0, // EP_SLICE: 0, 5
EB_SLICE = 1, // EB_SLICE: 1, 6
EI_SLICE = 2 // EI_SLICE: 2, 7
};
/* List Index */
enum EListIndex {
LIST_0 = 0,
LIST_1 = 1,
LIST_A = 2
};
struct SMVUnitXY { // each 4 Bytes
@ -192,21 +86,6 @@ bool bEnableSpsPpsIdAddition;
/* Motion Vector components */
enum EMvComp {
MV_X = 0,
MV_Y = 1,
MV_A = 2
};
/* Chroma Components */
enum EChromaComp {
CHROMA_CB = 0,
CHROMA_CR = 1,
CHROMA_A = 2
};
/* Position Offset structure */
typedef struct TagCropOffset {
int16_t iCropLeft;
@ -311,60 +190,5 @@ PSkip = 6
};
/*
* Memory Management Control Operation (MMCO) code
*/
enum EMmcoCode {
MMCO_END = 0,
MMCO_SHORT2UNUSED = 1,
MMCO_LONG2UNUSED = 2,
MMCO_SHORT2LONG = 3,
MMCO_SET_MAX_LONG = 4,
MMCO_RESET = 5,
MMCO_LONG = 6
};
/////////intra16x16 Luma
#define I16_PRED_INVALID -1
#define I16_PRED_V 0
#define I16_PRED_H 1
#define I16_PRED_DC 2
#define I16_PRED_P 3
#define I16_PRED_DC_L 4
#define I16_PRED_DC_T 5
#define I16_PRED_DC_128 6
#define I16_PRED_DC_A 7
//////////intra4x4 Luma
#define I4_PRED_INVALID 0
#define I4_PRED_V 0
#define I4_PRED_H 1
#define I4_PRED_DC 2
#define I4_PRED_DDL 3 //diagonal_down_left
#define I4_PRED_DDR 4 //diagonal_down_right
#define I4_PRED_VR 5 //vertical_right
#define I4_PRED_HD 6 //horizon_down
#define I4_PRED_VL 7 //vertical_left
#define I4_PRED_HU 8 //horizon_up
#define I4_PRED_DC_L 9
#define I4_PRED_DC_T 10
#define I4_PRED_DC_128 11
#define I4_PRED_DDL_TOP 12 //right-top replacing by padding rightmost pixel of top
#define I4_PRED_VL_TOP 13 //right-top replacing by padding rightmost pixel of top
#define I4_PRED_A 14
//////////intra Chroma
#define C_PRED_INVALID -1
#define C_PRED_DC 0
#define C_PRED_H 1
#define C_PRED_V 2
#define C_PRED_P 3
#define C_PRED_DC_L 4
#define C_PRED_DC_T 5
#define C_PRED_DC_128 6
#define C_PRED_A 7
}
#endif//WELS_COMMON_BASIS_H__

View File

@ -45,37 +45,6 @@ const uint8_t g_kuiSmb4AddrIn256[16] = {
16 * 8 + 8, 16 * 8 + 12, 16 * 12 + 8, 16 * 12 + 12
};
//////pNonZeroCount[16+8] mapping scan index
const uint8_t g_kuiMbCountScan4Idx[24] = {
// 0 1 | 4 5 luma 8*8 block pNonZeroCount[16+8]
0, 1, 4, 5, // 2 3 | 6 7 0 | 1 0 1 2 3
2, 3, 6, 7, //--------------- --------- 4 5 6 7
8, 9, 12, 13, // 8 9 | 12 13 2 | 3 8 9 10 11
10, 11, 14, 15, // 10 11 | 14 15-----------------------------> 12 13 14 15
16, 17, 20, 21, //---------------- chroma 8*8 block 16 17 18 19
18, 19, 22, 23 // 16 17 | 20 21 0 1 20 21 22 23
};
const uint8_t g_kuiCache48CountScan4Idx[24] = {
// [16 + 2*4]
9, 10, 17, 18,
11, 12, 19, 20,
25, 26, 33, 34,
27, 28, 35, 36,
14, 15,
22, 23,
38, 39,
46, 47
};
//cache element equal to 30
const uint8_t g_kuiCache30ScanIdx[16] = { //mv or uiRefIndex cache scan index, 4*4 block as basic unit
7, 8, 13, 14,
9, 10, 15, 16,
19, 20, 25, 26,
21, 22, 27, 28
};
const uint8_t g_kuiCache12_8x8RefIdx[4] = { //mv or uiRefIndex cache scan index, 4*4 block as basic unit
5, 6,
@ -86,83 +55,6 @@ const uint8_t g_kuiCache12_8x8RefIdx[4] = { //mv or uiRefIndex cache scan index,
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// extern at wels_common_basis.h
const uint8_t g_kuiChromaQpTable[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
};
/*
* vcl type map for given NAL unit type and corresponding H264 type (0: AVC; 1: SVC).
*/
const EVclType g_keTypeMap[32][2] = {
{ NON_VCL, NON_VCL }, // 0: NAL_UNIT_UNSPEC_0
{ VCL, VCL, }, // 1: NAL_UNIT_CODED_SLICE
{ VCL, NOT_APP }, // 2: NAL_UNIT_CODED_SLICE_DPA
{ VCL, NOT_APP }, // 3: NAL_UNIT_CODED_SLICE_DPB
{ VCL, NOT_APP }, // 4: NAL_UNIT_CODED_SLICE_DPC
{ VCL, VCL }, // 5: NAL_UNIT_CODED_SLICE_IDR
{ NON_VCL, NON_VCL }, // 6: NAL_UNIT_SEI
{ NON_VCL, NON_VCL }, // 7: NAL_UNIT_SPS
{ NON_VCL, NON_VCL }, // 8: NAL_UNIT_PPS
{ NON_VCL, NON_VCL }, // 9: NAL_UNIT_AU_DELIMITER
{ NON_VCL, NON_VCL }, // 10: NAL_UNIT_END_OF_SEQ
{ NON_VCL, NON_VCL }, // 11: NAL_UNIT_END_OF_STR
{ NON_VCL, NON_VCL }, // 12: NAL_UNIT_FILLER_DATA
{ NON_VCL, NON_VCL }, // 13: NAL_UNIT_SPS_EXT
{ NON_VCL, NON_VCL }, // 14: NAL_UNIT_PREFIX, NEED associate succeeded NAL to make a VCL
{ NON_VCL, NON_VCL }, // 15: NAL_UNIT_SUBSET_SPS
{ NON_VCL, NON_VCL }, // 16: NAL_UNIT_RESV_16
{ NON_VCL, NON_VCL }, // 17: NAL_UNIT_RESV_17
{ NON_VCL, NON_VCL }, // 18: NAL_UNIT_RESV_18
{ NON_VCL, NON_VCL }, // 19: NAL_UNIT_AUX_CODED_SLICE
{ NON_VCL, VCL }, // 20: NAL_UNIT_CODED_SLICE_EXT
{ NON_VCL, NON_VCL }, // 21: NAL_UNIT_RESV_21
{ NON_VCL, NON_VCL }, // 22: NAL_UNIT_RESV_22
{ NON_VCL, NON_VCL }, // 23: NAL_UNIT_RESV_23
{ NON_VCL, NON_VCL }, // 24: NAL_UNIT_UNSPEC_24
{ NON_VCL, NON_VCL }, // 25: NAL_UNIT_UNSPEC_25
{ NON_VCL, NON_VCL }, // 26: NAL_UNIT_UNSPEC_26
{ NON_VCL, NON_VCL }, // 27: NAL_UNIT_UNSPEC_27
{ NON_VCL, NON_VCL }, // 28: NAL_UNIT_UNSPEC_28
{ NON_VCL, NON_VCL }, // 29: NAL_UNIT_UNSPEC_29
{ NON_VCL, NON_VCL }, // 30: NAL_UNIT_UNSPEC_30
{ NON_VCL, NON_VCL } // 31: NAL_UNIT_UNSPEC_31
};
ALIGNED_DECLARE (const uint16_t, g_kuiDequantCoeff[52][8], 16) = {
/* 0*/{ 10, 13, 10, 13, 13, 16, 13, 16 }, /* 1*/{ 11, 14, 11, 14, 14, 18, 14, 18 },
/* 2*/{ 13, 16, 13, 16, 16, 20, 16, 20 }, /* 3*/{ 14, 18, 14, 18, 18, 23, 18, 23 },
/* 4*/{ 16, 20, 16, 20, 20, 25, 20, 25 }, /* 5*/{ 18, 23, 18, 23, 23, 29, 23, 29 },
/* 6*/{ 20, 26, 20, 26, 26, 32, 26, 32 }, /* 7*/{ 22, 28, 22, 28, 28, 36, 28, 36 },
/* 8*/{ 26, 32, 26, 32, 32, 40, 32, 40 }, /* 9*/{ 28, 36, 28, 36, 36, 46, 36, 46 },
/*10*/{ 32, 40, 32, 40, 40, 50, 40, 50 }, /*11*/{ 36, 46, 36, 46, 46, 58, 46, 58 },
/*12*/{ 40, 52, 40, 52, 52, 64, 52, 64 }, /*13*/{ 44, 56, 44, 56, 56, 72, 56, 72 },
/*14*/{ 52, 64, 52, 64, 64, 80, 64, 80 }, /*15*/{ 56, 72, 56, 72, 72, 92, 72, 92 },
/*16*/{ 64, 80, 64, 80, 80, 100, 80, 100 }, /*17*/{ 72, 92, 72, 92, 92, 116, 92, 116 },
/*18*/{ 80, 104, 80, 104, 104, 128, 104, 128 }, /*19*/{ 88, 112, 88, 112, 112, 144, 112, 144 },
/*20*/{ 104, 128, 104, 128, 128, 160, 128, 160 }, /*21*/{ 112, 144, 112, 144, 144, 184, 144, 184 },
/*22*/{ 128, 160, 128, 160, 160, 200, 160, 200 }, /*23*/{ 144, 184, 144, 184, 184, 232, 184, 232 },
/*24*/{ 160, 208, 160, 208, 208, 256, 208, 256 }, /*25*/{ 176, 224, 176, 224, 224, 288, 224, 288 },
/*26*/{ 208, 256, 208, 256, 256, 320, 256, 320 }, /*27*/{ 224, 288, 224, 288, 288, 368, 288, 368 },
/*28*/{ 256, 320, 256, 320, 320, 400, 320, 400 }, /*29*/{ 288, 368, 288, 368, 368, 464, 368, 464 },
/*30*/{ 320, 416, 320, 416, 416, 512, 416, 512 }, /*31*/{ 352, 448, 352, 448, 448, 576, 448, 576 },
/*32*/{ 416, 512, 416, 512, 512, 640, 512, 640 }, /*33*/{ 448, 576, 448, 576, 576, 736, 576, 736 },
/*34*/{ 512, 640, 512, 640, 640, 800, 640, 800 }, /*35*/{ 576, 736, 576, 736, 736, 928, 736, 928 },
/*36*/{ 640, 832, 640, 832, 832, 1024, 832, 1024 }, /*37*/{ 704, 896, 704, 896, 896, 1152, 896, 1152 },
/*38*/{ 832, 1024, 832, 1024, 1024, 1280, 1024, 1280 }, /*39*/{ 896, 1152, 896, 1152, 1152, 1472, 1152, 1472 },
/*40*/{ 1024, 1280, 1024, 1280, 1280, 1600, 1280, 1600 }, /*41*/{ 1152, 1472, 1152, 1472, 1472, 1856, 1472, 1856 },
/*42*/{ 1280, 1664, 1280, 1664, 1664, 2048, 1664, 2048 }, /*43*/{ 1408, 1792, 1408, 1792, 1792, 2304, 1792, 2304 },
/*44*/{ 1664, 2048, 1664, 2048, 2048, 2560, 2048, 2560 }, /*45*/{ 1792, 2304, 1792, 2304, 2304, 2944, 2304, 2944 },
/*46*/{ 2048, 2560, 2048, 2560, 2560, 3200, 2560, 3200 }, /*47*/{ 2304, 2944, 2304, 2944, 2944, 3712, 2944, 3712 },
/*48*/{ 2560, 3328, 2560, 3328, 3328, 4096, 3328, 4096 }, /*49*/{ 2816, 3584, 2816, 3584, 3584, 4608, 3584, 4608 },
/*50*/{ 3328, 4096, 3328, 4096, 4096, 5120, 4096, 5120 }, /*51*/{ 3584, 4608, 3584, 4608, 4608, 5888, 4608, 5888 },
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// extern at md.h
const int32_t g_kiQpCostTable[52] = {
1, 1, 1, 1, 1, 1, 1, 1, /* 0-7 */