Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -uNrp a/common/common.c b/common/common.c
- --- a/common/common.c 2011-08-25 10:27:19 +0800
- +++ b/common/common.c 2011-08-25 11:29:07 +0800
- @@ -106,8 +106,27 @@ void x264_param_default( x264_param_t *p
- param->rc.i_qp_step = 4;
- param->rc.f_ip_factor = 1.4;
- param->rc.f_pb_factor = 1.3;
- - param->rc.i_aq_mode = X264_AQ_VARIANCE;
- - param->rc.f_aq_strength = 1.0;
- + param->rc.i_aq_mode = X264_AQ_ORE;
- + param->rc.f_aq_strength = 0.5;
- + param->rc.f_aq_strengths[0][0] = 0;
- + param->rc.f_aq_strengths[0][1] = 0;
- + param->rc.f_aq_strengths[0][2] = 0;
- + param->rc.f_aq_strengths[0][3] = 0;
- + param->rc.f_aq_strengths[1][0] = 0;
- + param->rc.f_aq_strengths[1][1] = 0;
- + param->rc.f_aq_strengths[1][2] = 0;
- + param->rc.f_aq_strengths[1][3] = 0;
- + param->rc.f_aq_sensitivity = 10;
- + param->rc.f_aq_ifactor[0] = 1.0;
- + param->rc.f_aq_ifactor[1] = 1.0;
- + param->rc.f_aq_pfactor[0] = 1.0;
- + param->rc.f_aq_pfactor[1] = 1.0;
- + param->rc.f_aq_bfactor[0] = 1.0;
- + param->rc.f_aq_bfactor[1] = 1.0;
- + param->rc.b_aq_boundary = 0;
- + param->rc.i_aq_boundary[0] = 192;
- + param->rc.i_aq_boundary[1] = 64;
- + param->rc.i_aq_boundary[2] = 24;
- param->rc.i_lookahead = 40;
- param->rc.b_stat_write = 0;
- @@ -359,7 +378,7 @@ static int x264_param_apply_tune( x264_p
- else if( !strncasecmp( s, "ssim", 4 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- - param->rc.i_aq_mode = X264_AQ_AUTOVARIANCE;
- + param->rc.i_aq_mode = X264_AQ_MIXORE;
- param->analyse.b_psy = 0;
- }
- else if( !strncasecmp( s, "fastdecode", 10 ) )
- @@ -972,7 +991,61 @@ int x264_param_parse( x264_param_t *p, c
- OPT("aq-mode")
- p->rc.i_aq_mode = atoi(value);
- OPT("aq-strength")
- - p->rc.f_aq_strength = atof(value);
- + {
- + if( 8 == sscanf( value, "%f:%f:%f:%f:%f:%f:%f:%f",
- + &p->rc.f_aq_strengths[0][0], &p->rc.f_aq_strengths[1][0], &p->rc.f_aq_strengths[0][1], &p->rc.f_aq_strengths[1][1],
- + &p->rc.f_aq_strengths[0][2], &p->rc.f_aq_strengths[1][2], &p->rc.f_aq_strengths[0][3], &p->rc.f_aq_strengths[1][3] ) ||
- + 8 == sscanf( value, "%f,%f,%f,%f,%f,%f,%f,%f",
- + &p->rc.f_aq_strengths[0][0], &p->rc.f_aq_strengths[1][0], &p->rc.f_aq_strengths[0][1], &p->rc.f_aq_strengths[1][1],
- + &p->rc.f_aq_strengths[0][2], &p->rc.f_aq_strengths[1][2], &p->rc.f_aq_strengths[0][3], &p->rc.f_aq_strengths[1][3] ) )
- + p->rc.f_aq_strength = 0.0;
- + else if( 2 == sscanf( value, "%f:%f", &p->rc.f_aq_strengths[0][0], &p->rc.f_aq_strengths[1][0] ) ||
- + 2 == sscanf( value, "%f,%f", &p->rc.f_aq_strengths[0][0], &p->rc.f_aq_strengths[1][0] ) )
- + {
- + p->rc.f_aq_strength = 0.0;
- + for( i = 0; i < 2; i++ )
- + for( int j = 1; j < 4; j++ )
- + p->rc.f_aq_strengths[i][j] = p->rc.f_aq_strengths[i][0];
- + }
- + else if( sscanf( value, "%f", &p->rc.f_aq_strength ) )
- + for( i = 0; i < 2; i++ )
- + for( int j = 0; j < 4; j++ )
- + p->rc.f_aq_strengths[i][j] = p->rc.f_aq_strength;
- + }
- + OPT("aq-sensitivity")
- + p->rc.f_aq_sensitivity = atof(value);
- + OPT("aq-ifactor")
- + if( 2 == sscanf( value, "%f:%f", &p->rc.f_aq_ifactor[0], &p->rc.f_aq_ifactor[1] ) ||
- + 2 == sscanf( value, "%f,%f", &p->rc.f_aq_ifactor[0], &p->rc.f_aq_ifactor[1] ) )
- + { }
- + else if( sscanf( value, "%f", &p->rc.f_aq_ifactor[0] ) )
- + p->rc.f_aq_ifactor[1] = p->rc.f_aq_ifactor[0];
- + else
- + p->rc.f_aq_ifactor[1] = p->rc.f_aq_ifactor[0] = 1.0;
- + OPT("aq-pfactor")
- + if( 2 == sscanf( value, "%f:%f", &p->rc.f_aq_pfactor[0], &p->rc.f_aq_pfactor[1] ) ||
- + 2 == sscanf( value, "%f,%f", &p->rc.f_aq_pfactor[0], &p->rc.f_aq_pfactor[1] ) )
- + { }
- + else if( sscanf( value, "%f", &p->rc.f_aq_pfactor[0] ) )
- + p->rc.f_aq_pfactor[1] = p->rc.f_aq_pfactor[0];
- + else
- + p->rc.f_aq_pfactor[1] = p->rc.f_aq_pfactor[0] = 1.0;
- + OPT("aq-bfactor")
- + if( 2 == sscanf( value, "%f:%f", &p->rc.f_aq_bfactor[0], &p->rc.f_aq_bfactor[1] ) ||
- + 2 == sscanf( value, "%f,%f", &p->rc.f_aq_bfactor[0], &p->rc.f_aq_bfactor[1] ) )
- + { }
- + else if( sscanf( value, "%f", &p->rc.f_aq_bfactor[0] ) )
- + p->rc.f_aq_bfactor[1] = p->rc.f_aq_bfactor[0];
- + else
- + p->rc.f_aq_bfactor[1] = p->rc.f_aq_bfactor[0] = 1.0;
- + OPT("aq-boundary")
- + {
- + if( 3 == sscanf( value, "%d:%d:%d", &p->rc.i_aq_boundary[0], &p->rc.i_aq_boundary[1], &p->rc.i_aq_boundary[2] ) ||
- + 3 == sscanf( value, "%d,%d,%d", &p->rc.i_aq_boundary[0], &p->rc.i_aq_boundary[1], &p->rc.i_aq_boundary[2] ) )
- + p->rc.b_aq_boundary = 1;
- + else
- + p->rc.i_aq_boundary[0] = p->rc.i_aq_boundary[1] = p->rc.i_aq_boundary[2] = 0;
- + }
- OPT("fgo")
- p->analyse.i_fgo = atoi(value);
- OPT("fade-compensate")
- @@ -1412,7 +1485,16 @@ char *x264_param2string( x264_param_t *p
- s += sprintf( s, " pb_ratio=%.2f", p->rc.f_pb_factor );
- s += sprintf( s, " aq=%d", p->rc.i_aq_mode );
- if( p->rc.i_aq_mode )
- - s += sprintf( s, ":%.2f", p->rc.f_aq_strength );
- + {
- + s += sprintf( s, " aq-strength=%.2f:%.2f:%.2f:%.2f:%.2f:%.2f:%.2f:%.2f",
- + p->rc.f_aq_strengths[0][0], p->rc.f_aq_strengths[1][0], p->rc.f_aq_strengths[0][1], p->rc.f_aq_strengths[1][1],
- + p->rc.f_aq_strengths[0][2], p->rc.f_aq_strengths[1][2], p->rc.f_aq_strengths[0][3], p->rc.f_aq_strengths[1][3] );
- + s += sprintf( s, " aq-sensitivity=%.2f", p->rc.f_aq_sensitivity );
- + s += sprintf( s, " aq-ifactor=%.2f:%.2f", p->rc.f_aq_ifactor[0], p->rc.f_aq_ifactor[1] );
- + s += sprintf( s, " aq-pfactor=%.2f:%.2f", p->rc.f_aq_pfactor[0], p->rc.f_aq_pfactor[1] );
- + s += sprintf( s, " aq-bfactor=%.2f:%.2f", p->rc.f_aq_bfactor[0], p->rc.f_aq_bfactor[1] );
- + s += sprintf( s, " aq-boundary=%d:%d:%d", p->rc.i_aq_boundary[0], p->rc.i_aq_boundary[1], p->rc.i_aq_boundary[2] );
- + }
- if( p->rc.psz_zones )
- s += sprintf( s, " zones=%s", p->rc.psz_zones );
- else if( p->rc.i_zones )
- diff -uNrp a/common/common.h b/common/common.h
- --- a/common/common.h 2011-08-25 10:24:33 +0800
- +++ b/common/common.h 2011-08-25 11:30:10 +0800
- @@ -840,6 +840,13 @@ struct x264_t
- int64_t i_ssd[3];
- double f_ssim;
- int i_ssim_cnt;
- +
- + /* AQ stats per frame */
- + uint64_t i_aq_count[5];
- + uint64_t i_aq_result[5][3];
- + uint64_t i_aq_change[2*QP_MAX_SPEC+1];
- + int i_aq_change_min;
- + int i_aq_change_max;
- } frame;
- /* Cumulated stats */
- @@ -870,6 +877,13 @@ struct x264_t
- int i_direct_frames[2];
- /* num p-frames weighted */
- int i_wpred[2];
- + /* */
- + uint64_t i_aq_count_total;
- + uint64_t i_aq_count[5];
- + uint64_t i_aq_result[5][3];
- + uint64_t i_aq_change[2*QP_MAX_SPEC+1];
- + int i_aq_change_min;
- + int i_aq_change_max;
- } stat;
- diff -uNrp a/common/frame.c b/common/frame.c
- --- a/common/frame.c 2011-08-25 10:24:33 +0800
- +++ b/common/frame.c 2011-08-25 11:30:58 +0800
- @@ -232,6 +232,7 @@ static x264_frame_t *x264_frame_new( x26
- {
- CHECKED_MALLOC( frame->f_qp_offset, h->mb.i_mb_count * sizeof(float) );
- CHECKED_MALLOC( frame->f_qp_offset_aq, h->mb.i_mb_count * sizeof(float) );
- + CHECKED_MALLOC( frame->i_aq_type, h->mb.i_mb_count * sizeof(uint8_t) );
- if( h->frames.b_have_lowres )
- /* shouldn't really be initialized, just silences a valgrind false-positive in x264_mbtree_propagate_cost_sse2 */
- CHECKED_MALLOCZERO( frame->i_inv_qscale_factor, (h->mb.i_mb_count+3) * sizeof(uint16_t) );
- @@ -278,6 +279,7 @@ void x264_frame_delete( x264_frame_t *fr
- x264_free( frame->lowres_costs[j][i] );
- x264_free( frame->f_qp_offset );
- x264_free( frame->f_qp_offset_aq );
- + x264_free( frame->i_aq_type );
- x264_free( frame->i_inv_qscale_factor );
- x264_free( frame->i_row_bits );
- x264_free( frame->f_row_qp );
- diff -uNrp a/common/frame.h b/common/frame.h
- --- a/common/frame.h 2011-08-25 10:24:33 +0800
- +++ b/common/frame.h 2011-08-25 11:31:21 +0800
- @@ -125,6 +125,7 @@ typedef struct x264_frame
- float *f_row_qscale;
- float *f_qp_offset;
- float *f_qp_offset_aq;
- + uint8_t *i_aq_type; // OreAQ mode type
- int b_intra_calculated;
- uint16_t *i_intra_cost;
- uint16_t *i_propagate_cost;
- diff -uNrp a/common/pixel.c b/common/pixel.c
- --- a/common/pixel.c 2011-08-25 10:27:18 +0800
- +++ b/common/pixel.c 2011-08-25 11:32:40 +0800
- @@ -70,6 +70,23 @@ PIXEL_SAD_C( x264_pixel_sad_8x4, 8,
- PIXEL_SAD_C( x264_pixel_sad_4x8, 4, 8 )
- PIXEL_SAD_C( x264_pixel_sad_4x4, 4, 4 )
- +static int x264_pixel_count_8x8( uint8_t *pix, int i_pix, uint32_t threshold )
- +{
- + int sum = 0;
- + for( int y = 0; y < 8; y++, pix += i_pix )
- + for( int x = 0; x < 8; x++ )
- + sum += pix[x] > (uint8_t)threshold;
- + return sum;
- +}
- +
- +static int x264_pixel_count_16x16( uint8_t *pix, int i_pix, uint32_t threshold )
- +{
- + int sum = 0;
- + for( int y = 0; y < 16; y++, pix += i_pix )
- + for( int x = 0; x < 16; x++ )
- + sum += pix[x] > (uint8_t)threshold;
- + return sum;
- +}
- /****************************************************************************
- * pixel_ssd_WxH
- @@ -849,6 +866,8 @@ void x264_pixel_init( int cpu, x264_pixe
- pixf->ssim_end4 = ssim_end4;
- pixf->var2_8x8 = pixel_var2_8x8;
- pixf->vsad = pixel_vsad;
- + pixf->count_8x8 = x264_pixel_count_8x8;
- + pixf->count_16x16 = x264_pixel_count_16x16;
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4;
- pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4;
- diff -uNrp a/common/pixel.h b/common/pixel.h
- --- a/common/pixel.h 2011-08-25 10:27:18 +0800
- +++ b/common/pixel.h 2011-08-25 11:33:25 +0800
- @@ -109,6 +109,9 @@ typedef struct
- int (*ads[7])( int enc_dc[4], uint16_t *sums, int delta,
- uint16_t *cost_mvx, int16_t *mvs, int width, int thresh );
- + int (*count_8x8)( uint8_t *pix, int i_pix, uint32_t threshold );
- + int (*count_16x16)( uint8_t *pix, int i_pix, uint32_t threshold );
- +
- /* calculate satd or sad of V, H, and DC modes.
- * may be NULL, in which case just use pred+satd instead. */
- void (*intra_mbcmp_x3_16x16)( pixel *fenc, pixel *fdec , int res[3] );
- diff -uNrp a/encoder/analyse.c b/encoder/analyse.c
- --- a/encoder/analyse.c 2011-08-25 10:27:18 +0800
- +++ b/encoder/analyse.c 2011-08-25 11:34:07 +0800
- @@ -200,7 +200,10 @@ const float x264_log2_lut[128] =
- /* Avoid an int/float conversion. */
- const float x264_log2_lz_lut[32] =
- {
- - 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
- + 31.00024, 30.00024, 29.00024, 28.00024, 27.00024, 26.00024, 25.00024, 24.00024,
- + 23.00024, 22.00024, 21.00024, 20.00024, 19.00024, 18.00024, 17.00024, 16.00024,
- + 15.00024, 14.00024, 13.00024, 12.00024, 11.00024, 10.00024, 9.00024, 8.00024,
- + 7.00024, 6.00024, 5.00024, 4.00024, 3.00024, 2.00024, 1.00024, 0.00024
- };
- // should the intra and inter lambdas be different?
- diff -uNrp a/encoder/encoder.c b/encoder/encoder.c
- --- a/encoder/encoder.c 2011-08-25 10:27:19 +0800
- +++ b/encoder/encoder.c 2011-08-25 11:41:18 +0800
- @@ -772,10 +772,41 @@ static int x264_validate_parameters( x26
- if( !h->param.rc.b_mb_tree )
- h->param.rc.f_fade_compensate = 0;
- - h->param.rc.i_aq_mode = x264_clip3( h->param.rc.i_aq_mode, 0, 2 );
- - h->param.rc.f_aq_strength = x264_clip3f( h->param.rc.f_aq_strength, 0, 3 );
- - if( h->param.rc.f_aq_strength == 0 )
- - h->param.rc.i_aq_mode = 0;
- + h->param.rc.i_aq_mode = x264_clip3( h->param.rc.i_aq_mode, 0, 3 );
- + h->param.rc.f_aq_strength = x264_clip3f( h->param.rc.f_aq_strength, -3, 3 );
- + for( int i = 0; i < 2; i++ )
- + for( int j = 0; j < 4; j++ )
- + h->param.rc.f_aq_strengths[i][j] = x264_clip3f( h->param.rc.f_aq_strengths[i][j], -3, 3 );
- + if( h->param.rc.f_aq_strengths[0][0] == 0 && h->param.rc.f_aq_strengths[1][0] == 0 &&
- + h->param.rc.f_aq_strengths[0][1] == 0 && h->param.rc.f_aq_strengths[1][1] == 0 &&
- + h->param.rc.f_aq_strengths[0][2] == 0 && h->param.rc.f_aq_strengths[1][2] == 0 &&
- + h->param.rc.f_aq_strengths[0][3] == 0 && h->param.rc.f_aq_strengths[1][3] == 0 )
- + {
- + if( h->param.rc.f_aq_strength == 0 )
- + h->param.rc.i_aq_mode = 0;
- + else
- + for( int i = 0; i < 2; i++ )
- + for( int j = 0; j < 4; j++ )
- + h->param.rc.f_aq_strengths[i][j] = h->param.rc.f_aq_strength;
- + }
- + if( h->param.rc.f_aq_sensitivity < 0 )
- + h->param.rc.f_aq_sensitivity = 0;
- + for( int i = 0; i < 2; i++ )
- + {
- + h->param.rc.f_aq_ifactor[i] = x264_clip3f( h->param.rc.f_aq_ifactor[i], -10, 10 );
- + h->param.rc.f_aq_pfactor[i] = x264_clip3f( h->param.rc.f_aq_pfactor[i], -10, 10 );
- + h->param.rc.f_aq_bfactor[i] = x264_clip3f( h->param.rc.f_aq_bfactor[i], -10, 10 );
- + }
- + h->param.rc.i_aq_boundary[0] = x264_clip3( h->param.rc.i_aq_boundary[0], 0, 255 );
- + h->param.rc.i_aq_boundary[1] = x264_clip3( h->param.rc.i_aq_boundary[1], 0, 255 );
- + h->param.rc.i_aq_boundary[2] = x264_clip3( h->param.rc.i_aq_boundary[2], 0, 255 );
- + if( !h->param.rc.b_aq_boundary ||
- + h->param.rc.i_aq_boundary[0] <= h->param.rc.i_aq_boundary[1] || h->param.rc.i_aq_boundary[1] <= h->param.rc.i_aq_boundary[2] )
- + {
- + h->param.rc.i_aq_boundary[0] = h->param.vui.b_fullrange ? 205 : 192;
- + h->param.rc.i_aq_boundary[1] = h->param.vui.b_fullrange ? 56 : 64;
- + h->param.rc.i_aq_boundary[2] = h->param.vui.b_fullrange ? 9 : 24;
- + }
- if( h->param.i_log_level < X264_LOG_INFO && (!h->param.psz_log_file || h->param.i_log_file_level < X264_LOG_INFO) )
- {
- @@ -3216,6 +3247,22 @@ static int x264_encoder_frame_end( x264_
- }
- psz_message[79] = '\0';
- + if( h->param.rc.i_aq_mode )
- + {
- + h->stat.i_aq_count_total += h->mb.i_mb_count;
- + for( int i = 0; i < 5; i++ )
- + {
- + h->stat.i_aq_count[i] += h->stat.frame.i_aq_count[i];
- + h->stat.i_aq_result[i][0] += h->stat.frame.i_aq_result[i][0];
- + h->stat.i_aq_result[i][1] += h->stat.frame.i_aq_result[i][1];
- + h->stat.i_aq_result[i][2] += h->stat.frame.i_aq_result[i][2];
- + }
- + for( int i = h->stat.frame.i_aq_change_min+QP_MAX_SPEC; i <= h->stat.frame.i_aq_change_max+QP_MAX_SPEC; i++ )
- + h->stat.i_aq_change[i] += h->stat.frame.i_aq_change[i];
- + h->stat.i_aq_change_min = X264_MIN(h->stat.i_aq_change_min, h->stat.frame.i_aq_change_min);
- + h->stat.i_aq_change_max = X264_MAX(h->stat.i_aq_change_max, h->stat.frame.i_aq_change_max);
- + }
- +
- x264_log( h, X264_LOG_DEBUG,
- "frame=%4d QP=%.2f NAL=%d Slice:%c Poc:%-3d I:%-4d P:%-4d SKIP:%-4d size=%d bytes%s\n",
- h->i_frame,
- @@ -3287,7 +3334,7 @@ void x264_encoder_close ( x264_t *h
- int chroma_size = h->param.i_width * h->param.i_height >> (!CHROMA444 * 2);
- int64_t i_yuv_size = luma_size + chroma_size * 2;
- int64_t i_mb_count_size[2][7] = {{0}};
- - char buf[200];
- + char buf[1500];
- int b_print_pcm = h->stat.i_mb_count[SLICE_TYPE_I][I_PCM]
- || h->stat.i_mb_count[SLICE_TYPE_P][I_PCM]
- || h->stat.i_mb_count[SLICE_TYPE_B][I_PCM];
- @@ -3555,6 +3602,37 @@ void x264_encoder_close ( x264_t *h
- x264_log( h, X264_LOG_INFO, "ref %c L%d:%s\n", "PB"[i_slice], i_list, buf );
- }
- + if( h->stat.i_aq_count_total && !h->param.rc.b_mb_tree )
- + {
- +#define GET_AQ_RESULT(x) \
- + 100.0 / h->stat.i_aq_count_total * h->stat.i_aq_count[x], \
- + h->stat.i_aq_count[x] ? (100.0 / h->stat.i_aq_count[x] * h->stat.i_aq_result[x][0]) : 0, \
- + h->stat.i_aq_count[x] ? (100.0 / h->stat.i_aq_count[x] * h->stat.i_aq_result[x][1]) : 0, \
- + h->stat.i_aq_count[x] ? (100.0 / h->stat.i_aq_count[x] * h->stat.i_aq_result[x][2]) : 0
- + char *p = buf;
- +
- + x264_log( h, X264_LOG_INFO,
- + "AQ Result Bright MB:%5.2f%% QP Up:%5.2f%% Down:%5.2f%% Even:%5.2f%%\n",
- + GET_AQ_RESULT(1));
- +
- + x264_log( h, X264_LOG_INFO,
- + "AQ Result Middle MB:%5.2f%% QP Up:%5.2f%% Down:%5.2f%% Even:%5.2f%%\n",
- + GET_AQ_RESULT(2));
- +
- + x264_log( h, X264_LOG_INFO,
- + "AQ Result Dark MB:%5.2f%% QP Up:%5.2f%% Down:%5.2f%% Even:%5.2f%%\n",
- + GET_AQ_RESULT(3));
- +
- + x264_log( h, X264_LOG_INFO,
- + "AQ Result M.Dark MB:%5.2f%% QP Up:%5.2f%% Down:%5.2f%% Even:%5.2f%%\n",
- + GET_AQ_RESULT(4));
- +
- + for( int i = h->stat.i_aq_change_min; i <= h->stat.i_aq_change_max; i++ )
- + p += sprintf( p, " %d:%.2f%%", -i, 100.0 / h->stat.i_aq_count_total * h->stat.i_aq_change[i + QP_MAX_SPEC] );
- + x264_log( h, X264_LOG_INFO, "AQ change value %s\n", buf );
- +
- + }
- +
- if( h->param.analyse.b_ssim )
- {
- float ssim = SUM3( h->stat.f_ssim_mean_y ) / duration;
- diff -uNrp a/encoder/ratecontrol.c b/encoder/ratecontrol.c
- --- a/encoder/ratecontrol.c 2011-08-25 10:27:19 +0800
- +++ b/encoder/ratecontrol.c 2011-08-25 11:53:26 +0800
- @@ -149,6 +149,9 @@ struct x264_ratecontrol_t
- int bframes; /* # consecutive B-frames before this P-frame */
- int bframe_bits; /* total cost of those frames */
- + /* AQ stuff */
- + float aq_threshold;
- +
- int i_zones;
- x264_zone_t *zones;
- x264_zone_t *prev_zone;
- @@ -237,7 +240,7 @@ static ALWAYS_INLINE uint32_t ac_energy_
- }
- // Find the total AC energy of the block in all planes.
- -static NOINLINE uint32_t x264_ac_energy_mb( x264_t *h, int mb_x, int mb_y, x264_frame_t *frame )
- +static NOINLINE uint32_t x264_ac_energy_mb( x264_t *h, int mb_x, int mb_y, x264_frame_t *frame, uint32_t *energy )
- {
- /* This function contains annoying hacks because GCC has a habit of reordering emms
- * and putting it after floating point ops. As a result, we put the emms at the end of the
- @@ -248,44 +251,223 @@ static NOINLINE uint32_t x264_ac_energy_
- {
- /* We don't know the super-MB mode we're going to pick yet, so
- * simply try both and pick the lower of the two. */
- - uint32_t var_interlaced, var_progressive;
- - var_interlaced = ac_energy_plane( h, mb_x, mb_y, frame, 0, 0, 1, 1 );
- - var_progressive = ac_energy_plane( h, mb_x, mb_y, frame, 0, 0, 0, 0 );
- + uint32_t var_interlaced_y = ac_energy_plane( h, mb_x, mb_y, frame, 0, 0, 1, 1 );
- + uint32_t var_progressive_y = ac_energy_plane( h, mb_x, mb_y, frame, 0, 0, 0, 0 );
- + uint32_t var_interlaced_uv;
- + uint32_t var_progressive_uv;
- if( CHROMA444 )
- {
- - var_interlaced += ac_energy_plane( h, mb_x, mb_y, frame, 1, 0, 1, 1 );
- - var_progressive += ac_energy_plane( h, mb_x, mb_y, frame, 1, 0, 0, 0 );
- - var_interlaced += ac_energy_plane( h, mb_x, mb_y, frame, 2, 0, 1, 1 );
- - var_progressive += ac_energy_plane( h, mb_x, mb_y, frame, 2, 0, 0, 0 );
- + var_interlaced_uv = ac_energy_plane( h, mb_x, mb_y, frame, 1, 0, 1, 1 );
- + var_progressive_uv = ac_energy_plane( h, mb_x, mb_y, frame, 1, 0, 0, 0 );
- + var_interlaced_uv += ac_energy_plane( h, mb_x, mb_y, frame, 2, 0, 1, 1 );
- + var_progressive_uv += ac_energy_plane( h, mb_x, mb_y, frame, 2, 0, 0, 0 );
- + }
- + else
- + {
- + var_interlaced_uv = ac_energy_plane( h, mb_x, mb_y, frame, 1, 1, 1, 1 );
- + var_progressive_uv = ac_energy_plane( h, mb_x, mb_y, frame, 1, 1, 0, 0 );
- + }
- + uint32_t var_interlaced = var_interlaced_y + var_interlaced_uv;
- + uint32_t var_progressive = var_progressive_y + var_progressive_uv;
- + if( var_interlaced < var_progressive )
- + {
- + var = var_interlaced;
- + energy[0] = var_interlaced_y;
- + energy[1] = var_interlaced_uv;
- }
- else
- {
- - var_interlaced += ac_energy_plane( h, mb_x, mb_y, frame, 1, 1, 1, 1 );
- - var_progressive += ac_energy_plane( h, mb_x, mb_y, frame, 1, 1, 0, 0 );
- + var = var_progressive;
- + energy[0] = var_progressive_y;
- + energy[1] = var_progressive_uv;
- }
- - var = X264_MIN( var_interlaced, var_progressive );
- }
- else
- {
- - var = ac_energy_plane( h, mb_x, mb_y, frame, 0, 0, PARAM_INTERLACED, 1 );
- +
- + energy[0] = ac_energy_plane( h, mb_x, mb_y, frame, 0, 0, PARAM_INTERLACED, 1 );
- if( CHROMA444 )
- {
- - var += ac_energy_plane( h, mb_x, mb_y, frame, 1, 0, PARAM_INTERLACED, 1 );
- - var += ac_energy_plane( h, mb_x, mb_y, frame, 2, 0, PARAM_INTERLACED, 1 );
- + energy[1] = ac_energy_plane( h, mb_x, mb_y, frame, 1, 0, PARAM_INTERLACED, 1 );
- + energy[1] += ac_energy_plane( h, mb_x, mb_y, frame, 2, 0, PARAM_INTERLACED, 1 );
- }
- else
- - var += ac_energy_plane( h, mb_x, mb_y, frame, 1, 1, PARAM_INTERLACED, 1 );
- + energy[1] = ac_energy_plane( h, mb_x, mb_y, frame, 1, 1, PARAM_INTERLACED, 1 );
- + var = energy[0] + energy[1];
- }
- x264_emms();
- return var;
- }
- +static NOINLINE void get_image_mb( x264_t *h, int mb_x, int mb_y, x264_frame_t *frame, int b_field, int *luma, int *bluePoint )
- +{
- + ALIGNED_16( static uint8_t zero[17] ) = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
- + if( CHROMA444 )
- + {
- + int stride[3];
- + int offset[3];
- + for( int i = 0; i < 3; i++ )
- + {
- + stride[i] = frame->i_stride[i];
- + offset[i] = b_field
- + ? 16 * (mb_x + (mb_y&~1) * stride[i]) + (mb_y&1) * stride[i]
- + : 16 * (mb_x + mb_y * stride[i]);
- + stride[i] <<= b_field;
- + }
- + *luma = h->pixf.sad[PIXEL_16x16]( frame->plane[0] + offset[0], stride[0], zero, 0 ) >> 8;
- + *bluePoint =
- + (h->pixf.count_16x16( frame->plane[1] + offset[1], stride[1], 0x81818181 ) >= 40) &&
- + (h->pixf.count_16x16( frame->plane[2] + offset[2], stride[2], 0x87878787 ) <= 24);
- + }
- + else
- + {
- + int stride[2];
- + int offset[2];
- + for( int i = 0; i < 2; i++ )
- + {
- + int w = i ? 8 : 16;
- + stride[i] = frame->i_stride[i];
- + offset[i] = b_field
- + ? 16 * mb_x + w *(mb_y&~1) * stride[i] + (mb_y&1) * stride[i]
- + : 16 * mb_x + w * mb_y * stride[i];
- + stride[i] <<= b_field;
- + }
- + *luma = h->pixf.sad[PIXEL_16x16]( frame->plane[0] + offset[0], stride[0], zero, 0 ) >> 8;
- + ALIGNED_ARRAY_16( pixel, pix,[FENC_STRIDE*8] );
- + h->mc.load_deinterleave_8x8x2_fenc( pix, frame->plane[1] + offset[1], stride[1] );
- + *bluePoint =
- + (h->pixf.count_8x8( pix, FENC_STRIDE, 0x81818181 ) >= 40) &&
- + (h->pixf.count_8x8( pix+FENC_STRIDE/2, FENC_STRIDE, 0x87878787 ) <= 24);
- + }
- +}
- +
- +static NOINLINE float x264_adjust_OreAQ( x264_t *h, int mb_x, int mb_y, x264_frame_t *frame, uint32_t *energy )
- +{
- + uint8_t mode;
- + int bluePoint = 0;
- + int luma = 0;
- + float energy_y, energy_uv, f_qp_adj;
- + uint32_t _energy_y, _energy_uv;
- +
- + get_image_mb( h, mb_x, mb_y, frame, PARAM_INTERLACED, &luma, &bluePoint );
- + x264_emms();
- +
- + _energy_y = X264_MAX( energy[0], 1 );
- + _energy_uv = X264_MAX( energy[1], 1 );
- +
- + // logf(energy) = 1.0397 * x264_log2( energy ) / 1.5
- + // energy_y = 1.2 * (logf(_energy_y ) - ((h->rc->aq_threshold + 2*(BIT_DEPTH-8)) * .91) + 0.5);
- + // energy_uv = 0.8 * (logf(_energy_uv) - ((h->rc->aq_threshold + 2*(BIT_DEPTH-8)) * .91) + 0.5);
- + energy_y = 0.83176f * x264_log2( _energy_y ) - ((h->rc->aq_threshold + 2*(BIT_DEPTH-8)) * 1.092f) + 0.5f;
- + energy_uv = 0.55451f * x264_log2( _energy_uv ) - ((h->rc->aq_threshold + 2*(BIT_DEPTH-8)) * 0.728f) + 0.5f;
- + f_qp_adj = 0.f;
- +
- + if( luma > h->param.rc.i_aq_boundary[0] )
- + {
- + // *** Bright ***
- + // Y & UV Flat -> qp up
- + // Y Flat / UV Bump -> qp y up
- + // Y Bump / UV Flat -> even
- + // Y & UV Bump -> qp down
- + mode = 0x00;
- +
- + // qp up
- + if( !bluePoint && energy_y < 0 && energy_uv < 0 )
- + f_qp_adj = X264_MIN( energy_y, energy_uv );
- + // qp y up
- + else if( !bluePoint && energy_y < 0 && energy_uv >= 0 )
- + f_qp_adj = energy_y;
- + // qp down
- + else if( energy_y >= 0 && energy_uv >= 0 )
- + f_qp_adj = X264_MAX( energy_y, energy_uv ) * 0.5f;
- + }
- + else if( luma > h->param.rc.i_aq_boundary[1] )
- + {
- + // *** Middle ***
- + // Y & UV Flat -> qp up
- + // Y Flat / UV Bump -> even
- + // Y Bump / UV Flat -> qp mix down
- + // Y & UV Bump -> qp down
- + mode = 0x01;
- +
- + // qp up
- + if( !bluePoint && energy_y < 0 && energy_uv < 0 )
- + f_qp_adj = X264_MAX( energy_y, energy_uv );
- + // qp mix down
- + else if( energy_y >= 0 && energy_uv < 0 )
- + f_qp_adj = X264_MAX( energy_y + (!bluePoint * energy_uv), 0 ) * 0.5f;
- + // qp down
- + else if( energy_y >= 0 && energy_uv >= 0 )
- + f_qp_adj = X264_MAX( energy_y, bluePoint * energy_uv );
- + }
- + else if( luma > h->param.rc.i_aq_boundary[2] )
- + {
- + // *** Dark ***
- + // Y & UV Flat -> qp up
- + // Y Flat / UV Bump -> qp uv down
- + // Y Bump / UV Flat -> qp y down
- + // Y & UV Bump -> qp down
- + mode = 0x02;
- +
- + // qp up
- + if( energy_y < 0 && energy_uv < 0 )
- + f_qp_adj = X264_MAX( energy_y, energy_uv ) * 0.5f;
- + // qp uv down
- + else if( energy_y < 0 && energy_uv >= 0 )
- + f_qp_adj = energy_uv * 1.25f;
- + // qp y down
- + else if( energy_y >= 0 && energy_uv < 0 )
- + f_qp_adj = energy_y * 1.25f;
- + // qp down
- + else if( energy_y >= 0 && energy_uv >= 0 )
- + f_qp_adj = X264_MAX( energy_y, energy_uv ) * 1.25f;
- + }
- + else
- + {
- + // *** M.Dark ***
- + // Y & UV Flat -> qp double up
- + // Y Flat / UV Bump -> qp y up
- + // Y Bump / UV Flat -> qp uv up
- + // Y & UV Bump -> even
- + mode = 0x03;
- +
- + // qp double up
- + if( energy_y < 0 && energy_uv < 0 )
- + f_qp_adj = energy_y + energy_uv;
- + // qp mix up
- + else if( energy_y < 0 && energy_uv >= 0 )
- + f_qp_adj = energy_y;
- + // qp uv down
- + else if( energy_y >= 0 && energy_uv < 0 )
- + f_qp_adj = energy_uv * 0.5f;
- + }
- +
- + /* If f_qp_adj is positive, then lower the qp. */
- + f_qp_adj *= h->param.rc.f_aq_strengths[f_qp_adj>0][mode];
- +
- + frame->i_aq_type[mb_x + mb_y*h->mb.i_mb_stride] = mode + 0x01;
- +
- + if( h->param.rc.i_aq_mode == X264_AQ_ORE )
- + {
- + /* If current MB is frame edge, lower the qp. */
- + if( mb_x == 0 || mb_y == 0 || mb_x == h->sps->i_mb_width - 1 || mb_y == h->sps->i_mb_height - 1 )
- + f_qp_adj += (float)( (energy_y<0) + (energy_uv<0) + 1 ) * ( h->param.rc.f_aq_strengths[1][3] + 0.5f );
- + }
- +
- + return -f_qp_adj;
- +}
- +
- void x264_adaptive_quant_frame( x264_t *h, x264_frame_t *frame, float *quant_offsets )
- {
- /* constants chosen to result in approximately the same overall bitrate as without AQ.
- * FIXME: while they're written in 5 significant digits, they're only tuned to 2. */
- - float strength;
- + float strength = 0.f;
- float avg_adj = 0.f;
- + uint32_t energy_yuv[2] = {0, 0};
- + int no_aq = h->param.rc.f_aq_strengths[0][0] == 0 && h->param.rc.f_aq_strengths[1][0] == 0 &&
- + h->param.rc.f_aq_strengths[0][1] == 0 && h->param.rc.f_aq_strengths[1][1] == 0 &&
- + h->param.rc.f_aq_strengths[0][2] == 0 && h->param.rc.f_aq_strengths[1][2] == 0 &&
- + h->param.rc.f_aq_strengths[0][3] == 0 && h->param.rc.f_aq_strengths[1][3] == 0;
- /* Initialize frame stats */
- for( int i = 0; i < 3; i++ )
- {
- @@ -294,10 +476,10 @@ void x264_adaptive_quant_frame( x264_t *
- }
- /* Degenerate cases */
- - if( h->param.rc.i_aq_mode == X264_AQ_NONE || h->param.rc.f_aq_strength == 0 )
- + if( h->param.rc.i_aq_mode == X264_AQ_NONE || no_aq )
- {
- /* Need to init it anyways for MB tree */
- - if( h->param.rc.i_aq_mode && h->param.rc.f_aq_strength == 0 )
- + if( h->param.rc.i_aq_mode && no_aq )
- {
- if( quant_offsets )
- {
- @@ -315,13 +497,14 @@ void x264_adaptive_quant_frame( x264_t *
- for( int mb_xy = 0; mb_xy < h->mb.i_mb_count; mb_xy++ )
- frame->i_inv_qscale_factor[mb_xy] = 256;
- }
- + memset( frame->i_aq_type, 0, h->mb.i_mb_count * sizeof(uint8_t) );
- }
- /* Need variance data for weighted prediction */
- if( h->param.analyse.i_weighted_pred )
- {
- for( int mb_y = 0; mb_y < h->mb.i_mb_height; mb_y++ )
- for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x++ )
- - x264_ac_energy_mb( h, mb_x, mb_y, frame );
- + x264_ac_energy_mb( h, mb_x, mb_y, frame, energy_yuv );
- }
- else
- return;
- @@ -329,41 +512,49 @@ void x264_adaptive_quant_frame( x264_t *
- /* Actual adaptive quantization */
- else
- {
- - if( h->param.rc.i_aq_mode == X264_AQ_AUTOVARIANCE )
- + h->rc->aq_threshold = logf( powf( h->param.rc.f_aq_sensitivity, 4 ) / 2.0 );
- +
- + if( h->param.rc.i_aq_mode == X264_AQ_MIXORE )
- {
- float bit_depth_correction = powf(1 << (BIT_DEPTH-8), 0.5f);
- float avg_adj_pow2 = 0.f;
- for( int mb_y = 0; mb_y < h->mb.i_mb_height; mb_y++ )
- for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x++ )
- {
- - uint32_t energy = x264_ac_energy_mb( h, mb_x, mb_y, frame );
- + uint32_t energy = x264_ac_energy_mb( h, mb_x, mb_y, frame, energy_yuv );
- float qp_adj = powf( energy + 1, 0.125f );
- - frame->f_qp_offset[mb_x + mb_y*h->mb.i_mb_stride] = qp_adj;
- avg_adj += qp_adj;
- avg_adj_pow2 += qp_adj * qp_adj;
- + frame->f_qp_offset[mb_x + mb_y*h->mb.i_mb_stride] = qp_adj;
- + frame->f_qp_offset_aq[mb_x + mb_y*h->mb.i_mb_stride] = x264_adjust_OreAQ( h, mb_x, mb_y, frame, energy_yuv );
- }
- avg_adj /= h->mb.i_mb_count;
- avg_adj_pow2 /= h->mb.i_mb_count;
- - strength = h->param.rc.f_aq_strength * avg_adj / bit_depth_correction;
- + strength = h->param.rc.f_aq_strengths[1][3] * avg_adj / bit_depth_correction;
- avg_adj = avg_adj - 0.5f * (avg_adj_pow2 - (14.f * bit_depth_correction)) / avg_adj;
- }
- - else
- - strength = h->param.rc.f_aq_strength * 1.0397f;
- for( int mb_y = 0; mb_y < h->mb.i_mb_height; mb_y++ )
- for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x++ )
- {
- float qp_adj;
- int mb_xy = mb_x + mb_y*h->mb.i_mb_stride;
- - if( h->param.rc.i_aq_mode == X264_AQ_AUTOVARIANCE )
- + if( h->param.rc.i_aq_mode == X264_AQ_MIXORE )
- {
- - qp_adj = frame->f_qp_offset[mb_xy];
- - qp_adj = strength * (qp_adj - avg_adj);
- + if( frame->f_qp_offset_aq[mb_xy] < -1 )
- + {
- + qp_adj = strength * (frame->f_qp_offset[mb_xy] - avg_adj);
- + qp_adj = X264_MIN( qp_adj, frame->f_qp_offset_aq[mb_xy] );
- + }
- + else if( frame->f_qp_offset_aq[mb_xy] >= 1 )
- + qp_adj = frame->f_qp_offset_aq[mb_xy];
- + else
- + qp_adj = strength * (frame->f_qp_offset[mb_xy] - avg_adj);
- }
- else
- {
- - uint32_t energy = x264_ac_energy_mb( h, mb_x, mb_y, frame );
- - qp_adj = strength * (x264_log2( X264_MAX(energy, 1) ) - (14.427f + 2*(BIT_DEPTH-8)));
- + x264_ac_energy_mb( h, mb_x, mb_y, frame, energy_yuv );
- + qp_adj = x264_adjust_OreAQ( h, mb_x, mb_y, frame, energy_yuv );
- }
- if( quant_offsets )
- qp_adj += quant_offsets[mb_xy];
- @@ -420,6 +611,8 @@ int x264_macroblock_tree_read( x264_t *h
- frame->i_inv_qscale_factor[i] = x264_exp2fix8(frame->f_qp_offset[i]);
- }
- rc->qpbuf_pos--;
- +
- + memset( frame->i_aq_type, 0, h->mb.i_mb_count * sizeof(uint8_t) );
- }
- else
- x264_stack_align( x264_adaptive_quant_frame, h, frame, quant_offsets );
- @@ -1524,17 +1717,32 @@ int x264_ratecontrol_qp( x264_t *h )
- int x264_ratecontrol_mb_qp( x264_t *h )
- {
- x264_emms();
- - float qp = h->rc->qpm;
- - if( h->param.rc.i_aq_mode )
- - {
- - /* MB-tree currently doesn't adjust quantizers in unreferenced frames. */
- - float qp_offset = h->fdec->b_kept_as_ref ? h->fenc->f_qp_offset[h->mb.i_mb_xy] : h->fenc->f_qp_offset_aq[h->mb.i_mb_xy];
- - /* Scale AQ's effect towards zero in emergency mode. */
- - if( qp > QP_MAX_SPEC )
- - qp_offset *= (QP_MAX - qp) / (QP_MAX - QP_MAX_SPEC);
- - qp += qp_offset;
- - }
- - return x264_clip3( qp + 0.5f, h->param.rc.i_qp_min, h->param.rc.i_qp_max );
- + float f_qp = h->rc->qpm;
- + if( !h->param.rc.i_aq_mode )
- + return x264_clip3( f_qp + 0.5f, h->param.rc.i_qp_min, h->param.rc.i_qp_max );
- +
- + /* MB-tree currently doesn't adjust quantizers in unreferenced frames. */
- + float qp_offset = h->fdec->b_kept_as_ref ? h->fenc->f_qp_offset[h->mb.i_mb_xy] : h->fenc->f_qp_offset_aq[h->mb.i_mb_xy];
- +
- + qp_offset *= h->sh.i_type == SLICE_TYPE_I ? h->param.rc.f_aq_ifactor[qp_offset<0]
- + : h->sh.i_type == SLICE_TYPE_P ? h->param.rc.f_aq_pfactor[qp_offset<0]
- + : h->sh.i_type == SLICE_TYPE_B ? h->param.rc.f_aq_bfactor[qp_offset<0]
- + : 1.f;
- +
- + /* Scale AQ's effect towards zero in emergency mode. */
- + if( f_qp > QP_MAX_SPEC )
- + qp_offset *= (QP_MAX - f_qp) / (QP_MAX - QP_MAX_SPEC);
- +
- + int i_qp = (int)(f_qp + qp_offset + 0.5f);
- + int i_qp_adj = x264_clip3( f_qp - i_qp + 0.5f, -QP_MAX_SPEC, QP_MAX_SPEC );
- +
- + h->stat.frame.i_aq_change[i_qp_adj + QP_MAX_SPEC] += 1;
- + h->stat.frame.i_aq_count[ h->fenc->i_aq_type[h->mb.i_mb_xy] ] += 1;
- + h->stat.frame.i_aq_result[ h->fenc->i_aq_type[h->mb.i_mb_xy] ][ i_qp_adj < 0 ? 0 :(i_qp_adj > 0 ? 1 : 2) ] += 1;
- + h->stat.frame.i_aq_change_min = X264_MIN(h->stat.frame.i_aq_change_min, i_qp_adj);
- + h->stat.frame.i_aq_change_max = X264_MAX(h->stat.frame.i_aq_change_max, i_qp_adj);
- +
- + return x264_clip3( i_qp, h->param.rc.i_qp_min, h->param.rc.i_qp_max );
- }
- /* In 2pass, force the same frame types as in the 1st pass */
- diff -uNrp a/x264.c b/x264.c
- --- a/x264.c 2011-08-25 10:27:19 +0800
- +++ b/x264.c 2011-08-25 11:55:13 +0800
- @@ -690,10 +690,25 @@ static void help( x264_param_t *defaults
- H2( " --chroma-qp-offset <integer> QP difference between chroma and luma [%d]\n", defaults->analyse.i_chroma_qp_offset );
- H2( " --aq-mode <integer> AQ method [%d]\n"
- " - 0: Disabled\n"
- - " - 1: Variance AQ (complexity mask)\n"
- - " - 2: Auto-variance AQ (experimental)\n", defaults->rc.i_aq_mode );
- - H1( " --aq-strength <float> Reduces blocking and blurring in flat and\n"
- - " textured areas. [%.1f]\n", defaults->rc.f_aq_strength );
- + " - 1: OreAQ\n"
- + " - 2: MixOre (experimental)\n", defaults->rc.i_aq_mode );
- + H1( " --aq-strength <float> Reduces blocking and blurring in bump and\n"
- + " clear-cut areas. [%.1f]\n", defaults->rc.f_aq_strength );
- + H2( " <Up:Down> or <Up1:Down1:Up2:Down2:Up3:Down3:Up4:OtherStuff>\n"
- + " Set QP up/down strength.\n" );
- + H1( " --aq-sensitivity <float> \"Center\" of AQ curve. [%.1f]\n"
- + " - 5: most QPs are raised\n"
- + " - 10: good general-use sensitivity\n"
- + " - 15: most QPs are lowered\n", defaults->rc.f_aq_sensitivity );
- + H2( " --aq-ifactor <Up:Down> AQ strength factor of I-frames [%.1f:%.1f]\n", defaults->rc.f_aq_ifactor[0], defaults->rc.f_aq_ifactor[1] );
- + H2( " --aq-pfactor <Up:Down> AQ strength factor of P-frames [%.1f:%.1f]\n", defaults->rc.f_aq_pfactor[0], defaults->rc.f_aq_pfactor[1] );
- + H2( " --aq-bfactor <Up:Down> AQ strength factor of B-frames [%.1f:%.1f]\n", defaults->rc.f_aq_bfactor[0], defaults->rc.f_aq_bfactor[1] );
- + H2( " --aq-boundary <int:int:int> AQ boundary. \n"
- + " fullrange=off: [192:64:24]\n"
- + " fullrange=on : [205:56:9]\n"
- + " #1: Bright-Middle\n"
- + " #2: Middle-Dark\n"
- + " #3: Dark-M.Dark\n" );
- H1( " --fade-compensate <float> Allocate more bits to fades [%.1f]\n", defaults->rc.f_fade_compensate );
- H2( " Approximate sane range: 0.0 - 1.0\n" );
- H1( "\n" );
- @@ -1062,7 +1077,12 @@ static struct option long_options[] =
- { "no-fast-pskip", no_argument, NULL, 0 },
- { "no-dct-decimate", no_argument, NULL, 0 },
- { "aq-strength", required_argument, NULL, 0 },
- + { "aq-sensitivity", required_argument, NULL, 0 },
- + { "aq-ifactor", required_argument, NULL, 0 },
- + { "aq-pfactor", required_argument, NULL, 0 },
- + { "aq-bfactor", required_argument, NULL, 0 },
- { "aq-mode", required_argument, NULL, 0 },
- + { "aq-boundary", required_argument, NULL, 0 },
- { "fgo", required_argument, NULL, 0 },
- { "fade-compensate", required_argument, NULL, 0 },
- { "deadzone-inter", required_argument, NULL, 0 },
- diff -uNrp a/x264.h b/x264.h
- --- a/x264.h 2011-08-25 10:27:19 +0800
- +++ b/x264.h 2011-08-25 11:56:42 +0800
- @@ -42,6 +42,8 @@
- #include "x264_config.h"
- #define X264_BUILD 116
- +#define X264_SUB_BUILD 2 // OreAQ
- +#define X264_AQ_MODE_ORE05 0x00000004
- /* x264_t:
- * opaque handler for encoder */
- @@ -150,8 +152,8 @@ typedef struct
- #define X264_RC_ABR 2
- #define X264_QP_AUTO 0
- #define X264_AQ_NONE 0
- -#define X264_AQ_VARIANCE 1
- -#define X264_AQ_AUTOVARIANCE 2
- +#define X264_AQ_ORE 1
- +#define X264_AQ_MIXORE 2
- #define X264_B_ADAPT_NONE 0
- #define X264_B_ADAPT_FAST 1
- #define X264_B_ADAPT_TRELLIS 2
- @@ -388,6 +390,13 @@ typedef struct x264_param_t
- int i_aq_mode; /* psy adaptive QP. (X264_AQ_*) */
- float f_aq_strength;
- + float f_aq_strengths[2][4]; /* Up{ Bright, Middle, Dark, M.Dark }, Down{ Bright, Middle, Dark, Other stuff } */
- + float f_aq_sensitivity;
- + float f_aq_ifactor[2]; /* { Up, Down } */
- + float f_aq_pfactor[2]; /* { Up, Down } */
- + float f_aq_bfactor[2]; /* { Up, Down } */
- + int b_aq_boundary;
- + int i_aq_boundary[3];
- float f_fade_compensate; /* Give more bits to fades. */
- int b_mb_tree; /* Macroblock-tree ratecontrol. */
- int i_lookahead;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement