当前位置: 首页 > 工具软件 > x264-go > 使用案例 >

x264源码分析--avcintra-class参数

费学
2023-12-01

看这个参数前可以先看维基百科介绍:

https://en.wikipedia.org/wiki/AVC-Intra

这个参数控制的是一组参数:

h->param.i_keyint_max = 1;//最大关键帧间隔
h->param.b_intra_refresh = 0;//是否要把I帧拆分到多个sei里面分开发送,从而平衡码率,和每一帧的大小
h->param.analyse.i_weighted_pred = 0;//
h->param.i_frame_reference = 1;
h->param.i_dpb_size = 1;

h->param.b_bluray_compat = 0;
h->param.b_vfr_input = 0;
h->param.b_aud = 1;
h->param.vui.i_chroma_loc = 0;
h->param.i_nal_hrd = X264_NAL_HRD_NONE;
h->param.b_deblocking_filter = 0;
h->param.b_stitchable = 1;
h->param.b_pic_struct = 0;
h->param.analyse.b_transform_8x8 = 1;
h->param.analyse.intra = X264_ANALYSE_I8x8;
h->param.analyse.i_chroma_qp_offset = res && type ? 3 : 4;
h->param.b_cabac = !type;
        h->param.rc.i_vbv_buffer_size = avcintra_lut[type][res][i].frame_size;
        h->param.rc.i_vbv_max_bitrate =
        h->param.rc.i_bitrate = h->param.rc.i_vbv_buffer_size * fps_num / fps_den;
        h->param.rc.i_rc_method = X264_RC_ABR;
        h->param.rc.f_vbv_buffer_init = 1.0;
        h->param.rc.b_filler = 1;
        h->param.i_cqm_preset = X264_CQM_CUSTOM;
        memcpy( h->param.cqm_4iy, x264_cqm_jvt4i, sizeof(h->param.cqm_4iy) );
        memcpy( h->param.cqm_4ic, avcintra_lut[type][res][i].cqm_4ic, sizeof(h->param.cqm_4ic) );
        memcpy( h->param.cqm_8iy, avcintra_lut[type][res][i].cqm_8iy, sizeof(h->param.cqm_8iy) );


        /* Need exactly 10 slices of equal MB count... why?  $deity knows... */
        h->param.i_slice_max_mbs = ((h->param.i_width + 15) / 16) * ((h->param.i_height + 15) / 16) / 10;
        h->param.i_slice_max_size = 0;
        /* The slice structure only allows a maximum of 2 threads for 1080i/p
         * and 1 or 5 threads for 720p */
        if( h->param.b_sliced_threads )
        {
            if( res )
                h->param.i_threads = X264_MIN( 2, h->param.i_threads );
            else
            {
                h->param.i_threads = X264_MIN( 5, h->param.i_threads );
                if( h->param.i_threads < 5 )
                    h->param.i_threads = 1;
            }
        }


        if( type )
            h->param.vui.i_sar_width = h->param.vui.i_sar_height = 1;
        else
        {
            h->param.vui.i_sar_width  = 4;
            h->param.vui.i_sar_height = 3;
        }


        /* Official encoder doesn't appear to go under 13
         * and Avid cannot handle negative QPs */
        h->param.rc.i_qp_min = X264_MAX( h->param.rc.i_qp_min, QP_BD_OFFSET + 1 );


 类似资料: