X264简介-Android上的使用(三)

X264简介-Android上的使用(三)

一、X264 .a文件的log2f错误:

libx264.a(encoder-8.o):encoder.c:function validate_parameters: error: undefined reference to 'log2f'

libx264.a(encoder-8.o):encoder.c:function x264_8_encoder_reconfig: error: undefined reference to 'log2f'

libx264.a(ratecontrol-10.o):ratecontrol.c:function x264_10_ratecontrol_new: error: undefined reference to 'log2'

根据Linux上编译时的警告信息:


encoder/encoder.c: In function 'validate_parameters':
encoder/encoder.c:870:9: warning: implicit declaration of function 'log2f' [-Wimplicit-function-declaration]
float qp_i = qp_p - 6*log2f( h->param.rc.f_ip_factor );
^
encoder/encoder.c:870:31: warning: incompatible implicit declaration of built-in function 'log2f' [enabled by default]
float qp_i = qp_p - 6*log2f( h->param.rc.f_ip_factor );

analyse.c:188:9: warning: implicit declaration of function 'log2f' [-Wimplicit-function-declaration]
logs[i] = log2f( i+1 ) * 2.0f + 1.718f;
^
encoder/analyse.c:188:19: warning: incompatible implicit declaration of built-in function 'log2f' [enabled by default]
logs[i] = log2f( i+1 ) * 2.0f + 1.718f;
^
encoder/ratecontrol.c: In function 'qscale2qp':
encoder/ratecontrol.c:208:5: warning: implicit declaration of function 'log2f' [-Wimplicit-function-declaration]
return (12.0f + QP_BD_OFFSET) + 6.0f * log2f( qscale/0.85f );
^
encoder/ratecontrol.c:208:44: warning: incompatible implicit declaration of built-in function 'log2f' [enabled by default]
return (12.0f + QP_BD_OFFSET) + 6.0f * log2f( qscale/0.85f );

/ratecontrol.c:789:9: warning: implicit declaration of function 'log2' [-Wimplicit-function-declaration]
double bits_required = log2( num )
^
encoder/ratecontrol.c:789:32: warning: incompatible implicit declaration of built-in function 'log2' [enabled by default]
double bits_required = log2( num )
^
encoder/ratecontrol.c:819:27: warning: incompatible implicit declaration of built-in function 'log2f' [enabled by default]
rc->ip_offset = 6.0 * log2f( h->param.rc.f_ip_factor );
^
encoder/ratecontrol.c: In function 'x264_10_ratecontrol_start':
encoder/ratecontrol.c:1508:24: warning: incompatible implicit declaration of built-in function 'log2f' [enabled by default]
q -= 6*log2f( zone->f_bitrate_factor );
^
encoder/set.c: In function 'x264_10_sps_init':
encoder/set.c:248:9: warning: implicit declaration of function 'log2f' [-Wimplicit-function-declaration]
sps->vui.i_log2_max_mv_length_vertical = (int)log2f( X264_MAX( 1, param->analyse.i_mv_range*4-1 ) ) + 1;
^
encoder/set.c:248:55: warning: incompatible implicit declaration of built-in function 'log2f' [enabled by default]
sps->vui.i_log2_max_mv_length_vertical = (int)log2f( X264_MAX( 1, param->analyse.i_mv_range*4-1 ) ) + 1;
^
encoder/encoder.c:870:9: warning: implicit declaration of function 'log2f' [-Wimplicit-function-declaration]
float qp_i = qp_p - 6*log2f( h->param.rc.f_ip_factor );
^
encoder/encoder.c:870:31: warning: incompatible implicit declaration of built-in function 'log2f' [enabled by default]
float qp_i = qp_p - 6*log2f( h->param.rc.f_ip_factor );

解决办法:源码中的 osdep.h 文件中的

X264简介-Android上的使用(三)_第1张图片

#if !HAVE_LOG2F  直接替换成  #if 1

你可能感兴趣的:(acdroid,音视频,c,c++,android,linux)