I noticed x264.h was versioned up to 104, but some APIs, like x264_picture_alloc, are not used anymore.<br><br>And sadly, my code is not working anymore. Basically, I copied the code from x264.c, but x264.c changed a lot, I need modify many lines to follow up.<br>
<br>=== Initialization ===<br><br> x264_param_t params;<br> x264_param_default(&params);<br><br> params.i_width = frame_param->width;<br> params.i_height = frame_param->height;<br> params.i_fps_num = (int) time_base;<br>
params.i_fps_den = 1;<br> params.i_timebase_num = params.i_fps_den;<br> params.i_timebase_den = params.i_fps_num;<br><br> params.b_annexb = 0;<br> params.b_dts_compress = 1;<br> params.b_repeat_headers = 0;<br>
<br> params.i_frame_reference = 1;<br><br> params.i_keyint_max = 30;<br> params.rc.i_bitrate = g_video_bitrate;<br> params.rc.i_vbv_max_bitrate = 40;<br> params.rc.f_rate_tolerance = 2.0f;<br> params.rc.i_lookahead = 0;<br>
<br> params.rc.i_rc_method = X264_RC_ABR;<br> params.rc.f_rf_constant = 2.0f;<br> params.rc.f_rf_constant_max = 37.0f;<br> params.rc.i_qp_min = 2;<br> params.rc.i_qp_max = 37;<br><br> params.rc.b_stat_write = 0;<br>
<br> params.i_bframe = 0;<br> params.b_cabac = 1;<br> params.analyse.inter = 0;<br> params.b_deblocking_filter = 1;<br> params.analyse.i_trellis = 2;<br> params.analyse.i_me_method = X264_ME_UMH;<br> params.analyse.inter |= X264_ANALYSE_I4x4 | X264_ANALYSE_I8x8 | X264_ANALYSE_PSUB16x16 | X264_ANALYSE_PSUB8x8 | X264_ANALYSE_BSUB16x16;<br>
params.analyse.b_chroma_me = 1;<br> params.analyse.b_transform_8x8 = 1;<br> params.analyse.i_direct_mv_pred = 3;<br> params.analyse.b_weighted_bipred = 1;<br> params.analyse.i_weighted_pred = 2;<br><br> params.i_threads = 1;<br>
<br> codec->x264 = x264_encoder_open(&params);<br> x264_encoder_parameters(codec->x264, &params);<br><br> codec->pic = (x264_picture_t*) calloc(1, sizeof(x264_picture_t));<br> x264_picture_init(codec->pic);<br>
x264_picture_alloc(codec->pic, params.i_csp, params.i_width, params.i_height);<br><br>=== Encoding, the input buffer is in YV12 ===<br><br> codec->pic->img.plane[0] = codec->yuv_buffer;<br> codec->pic->img.plane[1] = codec->pic->img.plane[0] + frame_param->height * frame_param->width;<br>
codec->pic->img.plane[2] = codec->pic->img.plane[0] + frame_param->height * frame_param->width + frame_param->height * frame_param->width / 4;<br><br> codec->pic->b_keyframe = 0;<br>
codec->pic->i_dts = 0;<br> codec->pic->i_pts = 0;<br><br> x264_picture_t pic_out;<br> x264_nal_t *nal;<br> int i_nal;<br><br> codec->pic->i_type = X264_TYPE_AUTO;<br>
codec->pic->i_qpplus1 = 0; <br> codec->pic->i_pts = codec->frame_index;<br> <br> int i_frame_size = x264_encoder_encode(codec->x264, &nal, &i_nal, codec->pic, &pic_out);<br>
<br>My program then crashed after the last statement. It works well until x264 version 102.<br><br>Regards,<br>191919<br>