From: Loren Merritt Date: Sun, 9 Oct 2005 06:10:03 +0000 (+0000) Subject: cosmetics: merge some duplicate tables X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=a75462ead66beb222aae1efe1958848c26dc4be6;p=x264.git cosmetics: merge some duplicate tables git-svn-id: svn://svn.videolan.org/x264/trunk@322 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/common/common.h b/common/common.h index 4149fbf6..1608d63f 100644 --- a/common/common.h +++ b/common/common.h @@ -509,5 +509,8 @@ struct x264_t #endif }; +// included at the end because it needs x264_t +#include "macroblock.h" + #endif diff --git a/common/frame.c b/common/frame.c index b23e38c4..ca0f78af 100644 --- a/common/frame.c +++ b/common/frame.c @@ -26,7 +26,6 @@ #include #include "common.h" -#include "macroblock.h" x264_frame_t *x264_frame_new( x264_t *h ) { @@ -224,25 +223,8 @@ void x264_frame_expand_border_lowres( x264_frame_t *frame ) } -/* FIXME theses tables are duplicated with the ones in macroblock.c */ -static const uint8_t block_idx_xy[4][4] = -{ - { 0, 2, 8, 10}, - { 1, 3, 9, 11}, - { 4, 6, 12, 14}, - { 5, 7, 13, 15} -}; -static const int i_chroma_qp_table[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 -}; +/* Deblocking filter */ -/* Deblocking filter (p153) */ static const int i_alpha_table[52] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/common/macroblock.c b/common/macroblock.c index 11e17545..0d785919 100644 --- a/common/macroblock.c +++ b/common/macroblock.c @@ -26,23 +26,6 @@ #include #include "common.h" -#include "macroblock.h" - -static const uint8_t block_idx_x[16] = -{ - 0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, 3 -}; -static const uint8_t block_idx_y[16] = -{ - 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3 -}; -static const uint8_t block_idx_xy[4][4] = -{ - { 0, 2, 8, 10}, - { 1, 3, 9, 11}, - { 4, 6, 12, 14}, - { 5, 7, 13, 15} -}; static const int dequant_mf[6][4][4] = { @@ -54,65 +37,6 @@ static const int dequant_mf[6][4][4] = { {18, 23, 18, 23}, {23, 29, 23, 29}, {18, 23, 18, 23}, {23, 29, 23, 29} } }; -static const int dequant8_mf[6][8][8] = -{ - { - {20, 19, 25, 19, 20, 19, 25, 19}, - {19, 18, 24, 18, 19, 18, 24, 18}, - {25, 24, 32, 24, 25, 24, 32, 24}, - {19, 18, 24, 18, 19, 18, 24, 18}, - {20, 19, 25, 19, 20, 19, 25, 19}, - {19, 18, 24, 18, 19, 18, 24, 18}, - {25, 24, 32, 24, 25, 24, 32, 24}, - {19, 18, 24, 18, 19, 18, 24, 18} - }, { - {22, 21, 28, 21, 22, 21, 28, 21}, - {21, 19, 26, 19, 21, 19, 26, 19}, - {28, 26, 35, 26, 28, 26, 35, 26}, - {21, 19, 26, 19, 21, 19, 26, 19}, - {22, 21, 28, 21, 22, 21, 28, 21}, - {21, 19, 26, 19, 21, 19, 26, 19}, - {28, 26, 35, 26, 28, 26, 35, 26}, - {21, 19, 26, 19, 21, 19, 26, 19} - }, { - {26, 24, 33, 24, 26, 24, 33, 24}, - {24, 23, 31, 23, 24, 23, 31, 23}, - {33, 31, 42, 31, 33, 31, 42, 31}, - {24, 23, 31, 23, 24, 23, 31, 23}, - {26, 24, 33, 24, 26, 24, 33, 24}, - {24, 23, 31, 23, 24, 23, 31, 23}, - {33, 31, 42, 31, 33, 31, 42, 31}, - {24, 23, 31, 23, 24, 23, 31, 23} - }, { - {28, 26, 35, 26, 28, 26, 35, 26}, - {26, 25, 33, 25, 26, 25, 33, 25}, - {35, 33, 45, 33, 35, 33, 45, 33}, - {26, 25, 33, 25, 26, 25, 33, 25}, - {28, 26, 35, 26, 28, 26, 35, 26}, - {26, 25, 33, 25, 26, 25, 33, 25}, - {35, 33, 45, 33, 35, 33, 45, 33}, - {26, 25, 33, 25, 26, 25, 33, 25} - }, { - {32, 30, 40, 30, 32, 30, 40, 30}, - {30, 28, 38, 28, 30, 28, 38, 28}, - {40, 38, 51, 38, 40, 38, 51, 38}, - {30, 28, 38, 28, 30, 28, 38, 28}, - {32, 30, 40, 30, 32, 30, 40, 30}, - {30, 28, 38, 28, 30, 28, 38, 28}, - {40, 38, 51, 38, 40, 38, 51, 38}, - {30, 28, 38, 28, 30, 28, 38, 28} - }, { - {36, 34, 46, 34, 36, 34, 46, 34}, - {34, 32, 43, 32, 34, 32, 43, 32}, - {46, 43, 58, 43, 46, 43, 58, 43}, - {34, 32, 43, 32, 34, 32, 43, 32}, - {36, 34, 46, 34, 36, 34, 46, 34}, - {34, 32, 43, 32, 34, 32, 43, 32}, - {46, 43, 58, 43, 46, 43, 58, 43}, - {34, 32, 43, 32, 34, 32, 43, 32} - } -}; - int x264_mb_predict_intra4x4_mode( x264_t *h, int idx ) { const int ma = h->mb.cache.intra4x4_pred_mode[x264_scan8[idx] - 1]; diff --git a/common/macroblock.h b/common/macroblock.h index fbb96d2b..8f963b58 100644 --- a/common/macroblock.h +++ b/common/macroblock.h @@ -173,6 +173,32 @@ static const int x264_zigzag_scan8[64] = 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63 }; +static const uint8_t block_idx_x[16] = +{ + 0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, 3 +}; +static const uint8_t block_idx_y[16] = +{ + 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3 +}; +static const uint8_t block_idx_xy[4][4] = +{ + { 0, 2, 8, 10 }, + { 1, 3, 9, 11 }, + { 4, 6, 12, 14 }, + { 5, 7, 13, 15 } +}; + +static const int i_chroma_qp_table[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 +}; + void x264_macroblock_cache_init( x264_t *h ); void x264_macroblock_slice_init( x264_t *h ); diff --git a/common/predict.c b/common/predict.c index 9dc3115e..659c696a 100644 --- a/common/predict.c +++ b/common/predict.c @@ -33,7 +33,6 @@ #include #include "common.h" -#include "macroblock.h" #ifdef _MSC_VER #undef HAVE_MMXEXT /* not finished now */ diff --git a/common/visualize.c b/common/visualize.c index 053c1b1b..8bd02d86 100644 --- a/common/visualize.c +++ b/common/visualize.c @@ -49,7 +49,6 @@ #include "common.h" #include "visualize.h" -#include "macroblock.h" #include "display.h" typedef struct { diff --git a/encoder/analyse.c b/encoder/analyse.c index b70f767d..6e4c3ab0 100644 --- a/encoder/analyse.c +++ b/encoder/analyse.c @@ -29,7 +29,6 @@ #include #include "common/common.h" -#include "common/macroblock.h" #include "macroblock.h" #include "me.h" #include "ratecontrol.h" @@ -143,13 +142,6 @@ static const int i_qp0_cost2_table[52] = { 3686,4645,5852,7373 }; -static const uint8_t block_idx_x[16] = { - 0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, 3 -}; -static const uint8_t block_idx_y[16] = { - 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3 -}; - /* TODO: calculate CABAC costs */ static const int i_mb_b_cost_table[19] = { 9, 9, 9, 9, 0, 0, 0, 1, 3, 7, 7, 7, 3, 7, 7, 7, 5, 9, 0 diff --git a/encoder/cabac.c b/encoder/cabac.c index 9cdb6360..fc9aa515 100644 --- a/encoder/cabac.c +++ b/encoder/cabac.c @@ -28,22 +28,6 @@ #include "common/common.h" #include "macroblock.h" -static const uint8_t block_idx_x[16] = -{ - 0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, 3 -}; -static const uint8_t block_idx_y[16] = -{ - 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3 -}; -static const uint8_t block_idx_xy[4][4] = -{ - { 0, 2, 8, 10}, - { 1, 3, 9, 11}, - { 4, 6, 12, 14}, - { 5, 7, 13, 15} -}; - static inline void x264_cabac_encode_ue_bypass( x264_cabac_t *cb, int exp_bits, int val ) { int k; diff --git a/encoder/cavlc.c b/encoder/cavlc.c index 74489ff4..e9634338 100644 --- a/encoder/cavlc.c +++ b/encoder/cavlc.c @@ -56,22 +56,6 @@ static const uint8_t sub_mb_type_b_to_golomb[13]= 10, 4, 5, 1, 11, 6, 7, 2, 12, 8, 9, 3, 0 }; -static const uint8_t block_idx_x[16] = -{ - 0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, 3 -}; -static const uint8_t block_idx_y[16] = -{ - 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3 -}; -static const uint8_t block_idx_xy[4][4] = -{ - { 0, 2, 8, 10}, - { 1, 3, 9, 11}, - { 4, 6, 12, 14}, - { 5, 7, 13, 15} -}; - #define BLOCK_INDEX_CHROMA_DC (-1) #define BLOCK_INDEX_LUMA_DC (-2) diff --git a/encoder/macroblock.c b/encoder/macroblock.c index 3b0e3405..c25538cf 100644 --- a/encoder/macroblock.c +++ b/encoder/macroblock.c @@ -29,22 +29,6 @@ #include "macroblock.h" -static const uint8_t block_idx_x[16] = -{ - 0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, 3 -}; -static const uint8_t block_idx_y[16] = -{ - 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3 -}; -static const uint8_t block_idx_xy[4][4] = -{ - { 0, 2, 8, 10 }, - { 1, 3, 9, 11 }, - { 4, 6, 12, 14 }, - { 5, 7, 13, 15 } -}; - /* def_quant4_mf only for probe_skip; actual encoding uses matrices from set.c */ /* FIXME this seems to make better decisions with cqm=jvt, but could screw up * with general custom matrices. */ @@ -64,16 +48,6 @@ static const int def_quant4_mf[6][4][4] = { 7282, 4559, 7282, 4559 }, { 4559, 2893, 4559, 2893 } } }; -static const int i_chroma_qp_table[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 -}; - /**************************************************************************** * Scan and Quant functions ****************************************************************************/ diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index 164b4fb9..e36741bd 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -34,7 +34,6 @@ #include "common/common.h" #include "common/cpu.h" -#include "common/macroblock.h" #include "ratecontrol.h" #if defined(SYS_FREEBSD) || defined(SYS_BEOS) || defined(SYS_NETBSD) diff --git a/encoder/set.c b/encoder/set.c index a145c5f8..b95a7876 100644 --- a/encoder/set.c +++ b/encoder/set.c @@ -34,7 +34,6 @@ #include "x264.h" #include "common/common.h" -#include "common/macroblock.h" #ifndef _MSC_VER #include "config.h" #endif diff --git a/encoder/slicetype_decision.c b/encoder/slicetype_decision.c index 440b970e..5226f547 100644 --- a/encoder/slicetype_decision.c +++ b/encoder/slicetype_decision.c @@ -26,7 +26,6 @@ #include #include "common/common.h" -#include "common/macroblock.h" #include "common/cpu.h" #include "macroblock.h" #include "me.h"