⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 macroblock.h

📁 另一个版本的x264的decoder
💻 H
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************** * macroblock.h: h264 encoder library ***************************************************************************** * Copyright (C) 2003 Laurent Aimar * $Id: macroblock.h,v 1.1 2004/06/03 19:27:07 fenrir Exp $ * * Authors: Laurent Aimar <fenrir@via.ecp.fr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA. *****************************************************************************/#ifndef _MACROBLOCK_H#define _MACROBLOCK_H 1struct {    int logWD_L;    int logWD_C;    int w0_L;    int w1_L;    int w0_C;    int w1_C;    int o0_L;    int o1_L;    int o0_C;    int o1_C;    int refIdxL0WP;    int refIdxL1WP;} weight_pred_para;enum macroblock_position_e{    MB_LEFT     = 0x01,    MB_TOP      = 0x02,    MB_TOPRIGHT = 0x04,    MB_PRIVATE  = 0x10,};/* -1 if unused, -2 if unavaible */#define REF_NOT_USED -1/* XXX mb_type isn't the one written in the bitstream -> only internal usage */#define IS_INTRA(type) ( (type) == I_4x4 || (type) == I_16x16 )#define IS_SKIP(type)  ( (type) == P_SKIP || (type) == B_SKIP )#define IS_DIRECT(type)  ( (type) == B_DIRECT )enum mb_class_e{    I_4x4           = 0,    I_16x16         = 1,    I_PCM           = 2,    P_L0            = 3,    P_8x8           = 4,    P_SKIP          = 5,    B_DIRECT        = 6,    B_L0_L0         = 7,    B_L0_L1         = 8,    B_L0_BI         = 9,    B_L1_L0         = 10,    B_L1_L1         = 11,    B_L1_BI         = 12,    B_BI_L0         = 13,    B_BI_L1         = 14,    B_BI_BI         = 15,    B_8x8           = 16,    B_SKIP          = 17,};static const int x264_mb_type_list0_table[18][2] ={    {0,0}, {0,0}, {0,0},    /* INTRA */    {1,1},                  /* P_L0 */    {0,0},                  /* P_8x8 */    {1,1},                  /* P_SKIP */    {0,0},                  /* B_DIRECT */    {1,1}, {1,0}, {1,1},    /* B_L0_* */    {0,1}, {0,0}, {0,1},    /* B_L1_* */    {1,1}, {1,0}, {1,1},    /* B_BI_* */    {0,0},                  /* B_8x8 */    {0,0}                   /* B_SKIP */};static const int x264_mb_type_list1_table[18][2] ={    {0,0}, {0,0}, {0,0},    /* INTRA */    {0,0},                  /* P_L0 */    {0,0},                  /* P_8x8 */    {0,0},                  /* P_SKIP */    {0,0},                  /* B_DIRECT */    {0,0}, {0,1}, {0,1},    /* B_L0_* */    {1,0}, {1,1}, {1,1},    /* B_L1_* */    {1,0}, {1,1}, {1,1},    /* B_BI_* */    {0,0},                  /* B_8x8 */    {0,0}                   /* B_SKIP */};#define IS_SUB4x4(type) ( (type ==D_L0_4x4)||(type ==D_L1_4x4)||(type ==D_BI_4x4))#define IS_SUB4x8(type) ( (type ==D_L0_4x8)||(type ==D_L1_4x8)||(type ==D_BI_4x8))#define IS_SUB8x4(type) ( (type ==D_L0_8x4)||(type ==D_L1_8x4)||(type ==D_BI_8x4))#define IS_SUB8x8(type) ( (type ==D_L0_8x8)||(type ==D_L1_8x8)||(type ==D_BI_8x8)||(type ==D_DIRECT_8x8))enum mb_partition_e{    /* sub partition type for P_8x8 and B_8x8 */    D_L0_4x4        = 0,    D_L0_8x4        = 1,    D_L0_4x8        = 2,    D_L0_8x8        = 3,    /* sub partition type for B_8x8 only */    D_L1_4x4        = 4,    D_L1_8x4        = 5,    D_L1_4x8        = 6,    D_L1_8x8        = 7,    D_BI_4x4        = 8,    D_BI_8x4        = 9,    D_BI_4x8        = 10,    D_BI_8x8        = 11,    D_DIRECT_8x8    = 12,    /* partition */    D_8x8           = 13,    D_16x8          = 14,    D_8x16          = 15,    D_16x16         = 16,};static const int x264_mb_partition_listX_table[2][17] ={{    1, 1, 1, 1, /* D_L0_* */    0, 0, 0, 0, /* D_L1_* */    1, 1, 1, 1, /* D_BI_* */    0,          /* D_DIRECT_8x8 */    0, 0, 0, 0  /* 8x8 .. 16x16 */},{    0, 0, 0, 0, /* D_L0_* */    1, 1, 1, 1, /* D_L1_* */    1, 1, 1, 1, /* D_BI_* */    0,          /* D_DIRECT_8x8 */    0, 0, 0, 0  /* 8x8 .. 16x16 */}};static const int x264_mb_partition_count_table[17] ={    /* sub L0 */    4, 2, 2, 1,    /* sub L1 */    4, 2, 2, 1,    /* sub BI */    4, 2, 2, 1,    /* Direct */    1,    /* Partition */    4, 2, 2, 1};typedef struct x264_PMbInfo{    uint8_t type;    uint8_t partition;} x264_PMbInfo;static const x264_PMbInfo x264_p_mb_type_info[5]={		{P_L0, D_16x16},	{P_L0, D_16x8},	{P_L0, D_8x16},	{P_8x8, D_8x8},	{P_8x8, D_8x8},};static const x264_PMbInfo x264_p_sub_mb_type_info[4]={	{P_L0, D_L0_8x8},	{P_L0, D_L0_8x4},	{P_L0, D_L0_4x8},	{P_L0, D_L0_4x4},};static const x264_PMbInfo x264_b_mb_type_info[23]={	{B_DIRECT, D_16x16},	{B_L0_L0, D_16x16},	{B_L1_L1, D_16x16},	{B_BI_BI, D_16x16},	{B_L0_L0, D_16x8},	{B_L0_L0, D_8x16},	{B_L1_L1, D_16x8},	{B_L1_L1, D_8x16},	{B_L0_L1, D_16x8},	{B_L0_L1, D_8x16},	{B_L1_L0, D_16x8},	{B_L1_L0, D_8x16},	{B_L0_BI, D_16x8},	{B_L0_BI, D_8x16},	{B_L1_BI, D_16x8},	{B_L1_BI, D_8x16},	{B_BI_L0, D_16x8},	{B_BI_L0, D_8x16},	{B_BI_L1, D_16x8},	{B_BI_L1, D_8x16},	{B_BI_BI, D_16x8},	{B_BI_BI, D_8x16},	{B_8x8 , D_8x8},};static const x264_PMbInfo x264_b_sub_mb_type_info[13]={	{B_DIRECT, D_DIRECT_8x8},	{B_L0_L0, D_L0_8x8},	{B_L1_L1, D_L1_8x8},	{B_BI_BI, D_BI_8x8},	{B_L0_L0, D_L0_8x4},	{B_L0_L0, D_L0_4x8},	{B_L1_L1, D_L1_8x4},	{B_L1_L1, D_L1_4x8},	{B_BI_BI, D_BI_8x4},	{B_BI_BI, D_BI_4x8},	{B_L0_L0, D_L0_4x4},	{B_L1_L1, D_L1_4x4},	{B_BI_BI, D_BI_8x4},};/* From ffmpeg *///the following defines may change, don't expect compatibility if you use them#define MB_TYPE_INTRA4x4   0x0001#define MB_TYPE_INTRA16x16 0x0002 //FIXME h264 specific#define MB_TYPE_INTRA_PCM  0x0004 //FIXME h264 specific#define MB_TYPE_16x16      0x0008#define MB_TYPE_16x8       0x0010#define MB_TYPE_8x16       0x0020#define MB_TYPE_8x8        0x0040#define MB_TYPE_INTERLACED 0x0080#define MB_TYPE_DIRECT2    0x0100 //FIXME#define MB_TYPE_ACPRED     0x0200#define MB_TYPE_GMC        0x0400#define MB_TYPE_SKIP       0x0800#define MB_TYPE_P0L0       0x1000#define MB_TYPE_P1L0       0x2000#define MB_TYPE_P0L1       0x4000#define MB_TYPE_P1L1       0x8000#define MB_TYPE_L0         (MB_TYPE_P0L0 | MB_TYPE_P1L0)#define MB_TYPE_L1         (MB_TYPE_P0L1 | MB_TYPE_P1L1)#define MB_TYPE_L0L1       (MB_TYPE_L0   | MB_TYPE_L1)#define MB_TYPE_QUANT      0x00010000#define MB_TYPE_CBP        0x00020000#define MB_TYPE_INTRA MB_TYPE_INTRA4x4 //default mb_type if theres just one type#define FF_IS_INTRA4x4(a)   ((a)&MB_TYPE_INTRA4x4)#define FF_IS_INTRA16x16(a) ((a)&MB_TYPE_INTRA16x16)#define FF_IS_PCM(a)        ((a)&MB_TYPE_INTRA_PCM)#define FF_IS_INTRA(a)      ((a)&7)#define FF_IS_INTER(a)      ((a)&(MB_TYPE_16x16|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8))#define FF_IS_SKIP(a)       ((a)&MB_TYPE_SKIP)#define FF_IS_INTRA_PCM(a)  ((a)&MB_TYPE_INTRA_PCM)#define FF_IS_INTERLACED(a) ((a)&MB_TYPE_INTERLACED)#define FF_IS_DIRECT(a)     ((a)&MB_TYPE_DIRECT2)#define FF_IS_GMC(a)        ((a)&MB_TYPE_GMC)#define FF_IS_16X16(a)      ((a)&MB_TYPE_16x16)#define FF_IS_16X8(a)       ((a)&MB_TYPE_16x8)#define FF_IS_8X16(a)       ((a)&MB_TYPE_8x16)#define FF_IS_8X8(a)        ((a)&MB_TYPE_8x8)#define FF_IS_SUB_8X8(a)    ((a)&MB_TYPE_16x16) //note reused#define FF_IS_SUB_8X4(a)    ((a)&MB_TYPE_16x8)  //note reused#define FF_IS_SUB_4X8(a)    ((a)&MB_TYPE_8x16)  //note reused#define FF_IS_SUB_4X4(a)    ((a)&MB_TYPE_8x8)   //note reused

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -