📄 block_const.c
字号:
/*
***********************************************************************
* COPYRIGHT AND WARRANTY INFORMATION
*
* Copyright 2003, Advanced Audio Video Coding Standard, Part II
*
* DISCLAIMER OF WARRANTY
*
* These software programs are available to the users without any
* license fee or royalty on an "as is" basis. The AVS disclaims
* any and all warranties, whether express, implied, or statutory,
* including any implied warranties of merchantability or of fitness
* for a particular purpose. In no event shall the contributors or
* the AVS be liable for any incidental, punitive, or consequential
* damages of any kind whatsoever arising from the use of this program.
*
* This disclaimer of warranty extends to the user of this program
* and user's customers, employees, agents, transferees, successors,
* and assigns.
*
* The AVS does not represent or warrant that the program furnished
* hereunder are free of infringement of any third-party patents.
* Commercial implementations of AVS, including shareware, may be
* subject to royalty fees to patent holders. Information regarding
* the AVS patent policy is available from the AVS Web site at
* http://www.avs.org.cn
*
* THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE AVS PATENT POLICY.
************************************************************************
*/
/*
*************************************************************************************
* File name: block_const.c
* Function: Constant Arrays, Transforms etc to be used with Adaptive Block Transforms
*
*************************************************************************************
*/
#include "defines.h"
#include "block.h"
const int SCAN[2][64][2] = // [scan_pos][x/y] ATTENTION: the ScanPositions are (pix,lin)!
{
{
{0,0},{0,1},{0,2},{1,0},{0,3},{0,4},{1,1},{1,2},
{0,5},{0,6},{1,3},{2,0},{2,1},{0,7},{1,4},{2,2},
{3,0},{1,5},{1,6},{2,3},{3,1},{3,2},{4,0},{1,7},
{2,4},{4,1},{2,5},{3,3},{4,2},{2,6},{3,4},{4,3},
{5,0},{5,1},{2,7},{3,5},{4,4},{5,2},{6,0},{5,3},
{3,6},{4,5},{6,1},{6,2},{5,4},{3,7},{4,6},{6,3},
{5,5},{4,7},{6,4},{5,6},{6,5},{5,7},{6,6},{7,0},
{6,7},{7,1},{7,2},{7,3},{7,4},{7,5},{7,6},{7,7}
},
{
{ 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}
}
};
//2D code tables for VLC encoding
//The first table is used for Intra coding,
//the other 3 are used for Inter, QPs 0-13, 14-21, 22-31
const char AVS_2D_VLC[NUM_2D_TABLES][16][8]=
{
{
{ 0, 1, 5, 13, 21, 31, 39, 47},//Inter. Is coded using Golomb 2
{-1, 3, 15, 33, 51, -1, -1, -1},
{-1, 7, 25, 53, -1, -1, -1, -1},
{-1, 9, 35, -1, -1, -1, -1, -1},
{-1, 11, 45, -1, -1, -1, -1, -1}, //max symbol for tables depending on golomb base:
{-1, 17, 55, -1, -1, -1, -1, -1}, //grad 0: 62
{-1, 19, -1, -1, -1, -1, -1, -1}, //grad 1: 61
{-1, 23, -1, -1, -1, -1, -1, -1}, //grad 2: 59
{-1, 27, -1, -1, -1, -1, -1, -1}, //grad 3: 55
{-1, 29, -1, -1, -1, -1, -1, -1}, //grad 4: 47
{-1, 37, -1, -1, -1, -1, -1, -1},
{-1, 41, -1, -1, -1, -1, -1, -1},
{-1, 43, -1, -1, -1, -1, -1, -1},
{-1, 49, -1, -1, -1, -1, -1, -1},
{-1, 57, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
},{
{ 0, 1, 3, 7, 9, 13, 19, 21},//Intra QP 0..13. Is coded using Golomb 0, 1, or 2.
{-1, 5, 15, 25, 31, 39, 45, 49},
{-1, 11, 29, 41, 51, -1, -1, -1},
{-1, 17, 35, 55, -1, -1, -1, -1},
{-1, 23, 43, -1, -1, -1, -1, -1},
{-1, 27, 57, -1, -1, -1, -1, -1},
{-1, 33, -1, -1, -1, -1, -1, -1},
{-1, 37, -1, -1, -1, -1, -1, -1},
{-1, 47, -1, -1, -1, -1, -1, -1},
{-1, 53, -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},
},{
{ 0, 1, 3, 9, 13, 19, 23, 31},//Intra QP 14..21. Is coded using Golomb 0, 1, or 2.
{-1, 5, 15, 27, 37, 49, 57, -1},
{-1, 7, 25, 43, -1, -1, -1, -1},
{-1, 11, 35, -1, -1, -1, -1, -1},
{-1, 17, 45, -1, -1, -1, -1, -1},
{-1, 21, 51, -1, -1, -1, -1, -1},
{-1, 29, -1, -1, -1, -1, -1, -1},
{-1, 33, -1, -1, -1, -1, -1, -1},
{-1, 39, -1, -1, -1, -1, -1, -1},
{-1, 41, -1, -1, -1, -1, -1, -1},
{-1, 47, -1, -1, -1, -1, -1, -1},
{-1, 53, -1, -1, -1, -1, -1, -1},
{-1, 55, -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},
},{
{ 0, 1, 5, 13, 21, 33, 43, 57},//Intra QP 22..31. Is coded using Golomb 0, 1, or 2.
{-1, 3, 17, 31, 49, -1, -1, -1},
{-1, 7, 25, 47, -1, -1, -1, -1},
{-1, 9, 35, -1, -1, -1, -1, -1},
{-1, 11, 41, -1, -1, -1, -1, -1},
{-1, 15, 51, -1, -1, -1, -1, -1},
{-1, 19, -1, -1, -1, -1, -1, -1},
{-1, 23, -1, -1, -1, -1, -1, -1},
{-1, 27, -1, -1, -1, -1, -1, -1},
{-1, 29, -1, -1, -1, -1, -1, -1},
{-1, 37, -1, -1, -1, -1, -1, -1},
{-1, 39, -1, -1, -1, -1, -1, -1},
{-1, 45, -1, -1, -1, -1, -1, -1},
{-1, 53, -1, -1, -1, -1, -1, -1},
{-1, 55, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
}
};
char AVS_2D_VLC_dec[4][64][2]={{{-1,-1}}}; //The -1 values indicate the table is not valid. It is generated the first time it's needed. It could also be placed here, but that is a potential source of bugs.
//masks to be used for the bits in Macroblock->cbp_blk (2.Jan.2001 dahlhoff)
//cbp_blk_masks[MB_mode 0..3][subblock 0..3] (all for b8=0)
const unsigned short int cbp_blk_masks[4]=
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -