/* pointer over mb of the frame to be compressed */
uint8_t *p_fenc[3];
- /* pointer over mb of the frame to be reconstrucated */
+ /* pointer over mb of the frame to be reconstructed */
uint8_t *p_fdec[3];
/* pointer over mb of the references */
/* real intra4x4_pred_mode if I_4X4 or I_8X8, I_PRED_4x4_DC if mb available, -1 if not */
int intra4x4_pred_mode[X264_SCAN8_SIZE];
- /* i_non_zero_count if availble else 0x80 */
+ /* i_non_zero_count if available else 0x80 */
int non_zero_count[X264_SCAN8_SIZE];
- /* -1 if unused, -2 if unavaible */
+ /* -1 if unused, -2 if unavailable */
int8_t ref[2][X264_SCAN8_SIZE];
- /* 0 if non avaible */
+ /* 0 if not available */
int16_t mv[2][X264_SCAN8_SIZE][2];
int16_t mvd[2][X264_SCAN8_SIZE][2];
int i_direct_score[2];
} frame;
- /* Cummulated stats */
+ /* Cumulated stats */
/* per slice info */
int i_slice_count[5];
void x264_deblock_h_chroma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
void x264_deblock_v_chroma_intra_mmxext( uint8_t *pix, int stride, int alpha, int beta );
void x264_deblock_h_chroma_intra_mmxext( uint8_t *pix, int stride, int alpha, int beta );
-#endif
#ifdef ARCH_X86_64
void x264_deblock_v_luma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
void x264_deblock_h_luma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
-#elif defined( HAVE_MMXEXT )
+#else
void x264_deblock_h_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
void x264_deblock_v8_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
x264_deblock_v8_luma_mmxext( pix+8, stride, alpha, beta, tc0+2 );
}
#endif
+#endif
void x264_deblock_init( int cpu, x264_deblock_function_t *pf )
{
#include "common.h"
-static const int dequant_mf[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} }
-};
-
int x264_mb_predict_intra4x4_mode( x264_t *h, int idx )
{
const int ma = h->mb.cache.intra4x4_pred_mode[x264_scan8[idx] - 1];
B_BI_BI = 16,
B_8x8 = 17,
B_SKIP = 18,
+
+ X264_MBTYPE_MAX = 19
};
-static const int x264_mb_type_fix[19] =
+static const int x264_mb_type_fix[X264_MBTYPE_MAX] =
{
I_4x4, I_4x4, I_16x16, I_PCM,
P_L0, P_8x8, P_SKIP,
B_DIRECT, B_L0_L0, B_L0_L1, B_L0_BI, B_L1_L0, B_L1_L1,
B_L1_BI, B_BI_L0, B_BI_L1, B_BI_BI, B_8x8, B_SKIP
};
-static const int x264_mb_type_list0_table[19][2] =
+static const int x264_mb_type_list0_table[X264_MBTYPE_MAX][2] =
{
{0,0}, {0,0}, {0,0}, {0,0}, /* INTRA */
{1,1}, /* P_L0 */
{0,0}, /* B_8x8 */
{0,0} /* B_SKIP */
};
-static const int x264_mb_type_list1_table[19][2] =
+static const int x264_mb_type_list1_table[X264_MBTYPE_MAX][2] =
{
{0,0}, {0,0}, {0,0}, {0,0}, /* INTRA */
{0,0}, /* P_L0 */
/* Sub 4x8 */
int i_cost4x8[4]; /* cost per 8x8 partition */
- x264_me_t me4x8[4][4];
+ x264_me_t me4x8[4][2];
/* 16x8 */
int i_cost16x8;
};
/* TODO: calculate CABAC costs */
-static const int i_mb_b_cost_table[19] = {
+static const int i_mb_b_cost_table[X264_MBTYPE_MAX] = {
9, 9, 9, 9, 0, 0, 0, 1, 3, 7, 7, 7, 3, 7, 7, 7, 5, 9, 0
};
static const int i_mb_b16x8_cost_table[17] = {
x264_macroblock_analyse( h );
TIMER_STOP( i_mtime_analyse );
- /* encode this macrobock -> be carefull it can change the mb type to P_SKIP if needed */
+ /* encode this macrobock -> be careful it can change the mb type to P_SKIP if needed */
TIMER_START( i_mtime_encode );
x264_macroblock_encode( h );
TIMER_STOP( i_mtime_encode );
h->stat.i_slice_size[i_slice_type] += i_frame_size + NALU_OVERHEAD;
h->stat.i_slice_qp[i_slice_type] += i_global_qp;
- for( i = 0; i < 19; i++ )
+ for( i = 0; i < X264_MBTYPE_MAX; i++ )
h->stat.i_mb_count[h->sh.i_type][i] += h->stat.frame.i_mb_count[i];
for( i = 0; i < 2; i++ )
h->stat.i_mb_count_8x8dct[i] += h->stat.frame.i_mb_count_8x8dct[i];
int mb_xy;
for( mb_xy = 0; mb_xy < h->sps->i_mb_width * h->sps->i_mb_height; mb_xy++ )
{
- if( h->mb.type[mb_xy] < 19 && h->mb.type[mb_xy] >= 0 )
+ if( h->mb.type[mb_xy] < X264_MBTYPE_MAX && h->mb.type[mb_xy] >= 0 )
fprintf( stderr, "%c ", mb_chars[ h->mb.type[mb_xy] ] );
else
fprintf( stderr, "? " );
x264_free( h->thread[i] );
x264_free( h );
}
-
{
const int i_qbits = 16 + i_qscale / 6;
const int i_mf = i_qscale % 6;
- const int f = ( 1 << i_qbits ) / ( b_intra ? 3 : 6 );
+ const int f = ( 1 << (i_qbits + b_intra) ) / 6;
h->quantf.quant_8x8_core( dct, quant_mf[i_mf], i_qbits, f );
}
static void quant_4x4( x264_t *h, int16_t dct[4][4], int quant_mf[6][4][4], int i_qscale, int b_intra )
{
const int i_qbits = 15 + i_qscale / 6;
const int i_mf = i_qscale % 6;
- const int f = ( 1 << i_qbits ) / ( b_intra ? 3 : 6 );
+ const int f = ( 1 << (i_qbits + b_intra) ) / 6;
h->quantf.quant_4x4_core( dct, quant_mf[i_mf], i_qbits, f );
}
static void quant_4x4_dc( x264_t *h, int16_t dct[4][4], int quant_mf[6][4][4], int i_qscale )
{
const int i_qbits = 16 + i_qscale / 6;
const int i_mf = i_qscale % 6;
- const int f = ( 1 << i_qbits ) / ( b_intra ? 3 : 6 );
+ const int f = ( 1 << (i_qbits + b_intra) ) / 6;
h->quantf.quant_2x2_dc_core( dct, quant_mf[i_mf][0][0], i_qbits, f );
}
/* encode the 8x8 blocks */
x264_mb_encode_8x8_chroma( h, !IS_INTRA( h->mb.i_type ), i_qp );
- /* Calculate the Luma/Chroma patern and non_zero_count */
+ /* Calculate the Luma/Chroma pattern and non_zero_count */
h->mb.i_cbp_luma = 0x00;
if( h->mb.i_type == I_16x16 )
{
}
}
- /* Calculate the chroma patern */
+ /* Calculate the chroma pattern */
h->mb.i_cbp_chroma = 0x00;
for( i = 0; i < 8; i++ )
{
#include "common/cpu.h"
#include "ratecontrol.h"
-#if defined(SYS_FREEBSD) || defined(SYS_BEOS) || defined(SYS_NETBSD) || defined(SYS_OPENBSD)
-#define exp2f(x) powf( 2, (x) )
-#endif
-#if defined(SYS_MACOSX)
-#define exp2f(x) (float)pow( 2, (x) )
-#define sqrtf sqrt
-#endif
#if defined(SYS_OPENBSD)
#define isfinite finite
#endif
#if defined(_MSC_VER)
#define isfinite _finite
#endif
-#if defined(_MSC_VER) || defined(SYS_SunOS)
-#define exp2f(x) pow( 2, (x) )
+#if defined(_MSC_VER) || defined(SYS_SunOS) || defined(SYS_MACOSX)
#define sqrtf sqrt
#endif
#ifdef WIN32 // POSIX says that rename() removes the destination, but win32 doesn't.
rc->qp_constant[SLICE_TYPE_I] = x264_clip3( h->param.rc.i_qp_constant - rc->ip_offset + 0.5, 0, 51 );
rc->qp_constant[SLICE_TYPE_B] = x264_clip3( h->param.rc.i_qp_constant + rc->pb_offset + 0.5, 0, 51 );
- rc->lstep = exp2f(h->param.rc.i_qp_step / 6.0);
+ rc->lstep = pow( 2, h->param.rc.i_qp_step / 6.0 );
rc->last_qscale = qp2qscale(26);
for( i = 0; i < 5; i++ )
{