⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 x264.c

📁 H.264 source codes
💻 C
📖 第 1 页 / 共 4 页
字号:
            { "qpmax",   required_argument, NULL, OPT_QPMAX },            { "qpstep",  required_argument, NULL, OPT_QPSTEP },            { "ref",     required_argument, NULL, 'r' },            { "no-asm",  no_argument,       NULL, 'C' },            { "sar",     required_argument, NULL, 's' },            { "fps",     required_argument, NULL, OPT_FPS },            { "frames",  required_argument, NULL, OPT_FRAMES },            { "seek",    required_argument, NULL, OPT_SEEK },            { "output",  required_argument, NULL, 'o' },            { "analyse", required_argument, NULL, 'A' },            { "direct",  required_argument, NULL, OPT_DIRECT },            { "weightb", no_argument,       NULL, 'w' },            { "me",      required_argument, NULL, OPT_ME },            { "merange", required_argument, NULL, OPT_MERANGE },            { "subme",   required_argument, NULL, 'm' },            { "no-chroma-me", no_argument,  NULL, OPT_NO_CHROMA_ME },            { "level",   required_argument, NULL, OPT_LEVEL },            { "ratetol", required_argument, NULL, OPT_RATETOL },            { "vbv-maxrate", required_argument, NULL, OPT_VBVMAXRATE },            { "vbv-bufsize", required_argument, NULL, OPT_VBVBUFSIZE },            { "vbv-init", required_argument,NULL,  OPT_VBVINIT },            { "ipratio", required_argument, NULL, OPT_IPRATIO },            { "pbratio", required_argument, NULL, OPT_PBRATIO },            { "chroma-qp-offset", required_argument, NULL, OPT_CHROMA_QP },            { "pass",    required_argument, NULL, 'p' },            { "stats",   required_argument, NULL, OPT_RCSTATS },            { "rceq",    required_argument, NULL, OPT_RCEQ },            { "qcomp",   required_argument, NULL, OPT_QCOMP },            { "qblur",   required_argument, NULL, OPT_QBLUR },            { "cplxblur",required_argument, NULL, OPT_CPLXBLUR },            { "no-psnr", no_argument,       NULL, OPT_NOPSNR },            { "quiet",   no_argument,       NULL, OPT_QUIET },            { "verbose", no_argument,       NULL, 'v' },            { "progress",no_argument,       NULL, OPT_PROGRESS },            { "visualize",no_argument,      NULL, OPT_VISUALIZE },            { "aud",     no_argument,       NULL, OPT_AUD },            {0, 0, 0, 0}        };        int c;        c = getopt_long( argc, argv, "hi:I:b:r:cxB:q:f:o:A:m:p:vw",                         long_options, &long_options_index);        if( c == -1 )        {            break;        }        switch( c )        {            case 'h':                Help( &defaults );                return -1;            case 0:                break;            case 'B':                param->rc.i_bitrate = atol( optarg );                param->rc.b_cbr = 1;                break;            case 'b':                param->i_bframe = atol( optarg );                break;            case OPT_NOBADAPT:                param->b_bframe_adaptive = 0;                break;            case OPT_BBIAS:                param->i_bframe_bias = atol( optarg );                break;            case OPT_BPYRAMID:                param->b_bframe_pyramid = 1;                break;            case 'i':                param->i_keyint_min = atol( optarg );                break;            case 'I':                param->i_keyint_max = atol( optarg );                break;            case OPT_SCENECUT:                param->i_scenecut_threshold = atol( optarg );                break;            case 'n':                param->b_deblocking_filter = 0;                break;            case 'f':            {                char *p = strchr( optarg, ':' );                param->i_deblocking_filter_alphac0 = atoi( optarg );                param->i_deblocking_filter_beta = p ? atoi( p+1 ) : param->i_deblocking_filter_alphac0;                break;            }            case 'q':                param->rc.i_qp_constant = atoi( optarg );                break;            case OPT_QPMIN:                param->rc.i_qp_min = atoi( optarg );                break;            case OPT_QPMAX:                param->rc.i_qp_max = atoi( optarg );                break;            case OPT_QPSTEP:                param->rc.i_qp_step = atoi( optarg );                break;            case 'r':                param->i_frame_reference = atoi( optarg );                break;            case OPT_NO_CABAC:                param->b_cabac = 0;                break;            case 'x':                opt->b_decompress = 1;                break;            case 'C':                param->cpu = 0;                break;            case OPT_FRAMES:                opt->i_maxframes = atoi( optarg );                break;            case OPT_SEEK:                opt->i_seek = atoi( optarg );                break;            case'o':                if( !strncasecmp(optarg + strlen(optarg) - 4, ".mp4", 4) )                {#ifdef MP4_OUTPUT                    p_open_outfile = open_file_mp4;                    p_write_nalu = write_nalu_mp4;                    p_set_outfile_param = set_param_mp4;                    p_set_eop = set_eop_mp4;                    p_close_outfile = close_file_mp4;#else                    fprintf( stderr, "not compiled with MP4 output support\n" );                    return -1;#endif                }                if( !strcmp(optarg, "-") )                    opt->hout = stdout;                else if( p_open_outfile( optarg, &opt->hout ) )                {                    fprintf( stderr, "cannot open output file `%s'\n", optarg );                    return -1;                }                break;            case 's':            {                char *p = strchr( optarg, ':' );                if( p )                {                    param->vui.i_sar_width = atoi( optarg );                    param->vui.i_sar_height = atoi( p + 1 );                }                break;            }            case OPT_FPS:            {                float fps;                if( sscanf( optarg, "%d/%d", &param->i_fps_num, &param->i_fps_den ) == 2 )                    ;                else if( sscanf( optarg, "%f", &fps ) )                {                    param->i_fps_num = (int)(fps * 1000 + .5);                    param->i_fps_den = 1000;                }                else                {                    fprintf( stderr, "bad fps `%s'\n", optarg );                    return -1;                }                break;            }            case 'A':                param->analyse.inter = 0;                if( strstr( optarg, "none" ) )  param->analyse.inter = 0x000000;                if( strstr( optarg, "all" ) )   param->analyse.inter = X264_ANALYSE_I4x4|X264_ANALYSE_PSUB16x16|X264_ANALYSE_PSUB8x8|X264_ANALYSE_BSUB16x16;                if( strstr( optarg, "i4x4" ) )  param->analyse.inter |= X264_ANALYSE_I4x4;                if( strstr( optarg, "p8x8" ) )  param->analyse.inter |= X264_ANALYSE_PSUB16x16;                if( strstr( optarg, "p4x4" ) )  param->analyse.inter |= X264_ANALYSE_PSUB8x8;                if( strstr( optarg, "b8x8" ) )  param->analyse.inter |= X264_ANALYSE_BSUB16x16;                break;            case OPT_DIRECT:                if( strstr( optarg, "temporal" ) )                    param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_TEMPORAL;                else if( strstr( optarg, "spatial" ) )                    param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL;                else if( strstr( optarg, "none" ) )                    param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_NONE;                else                    param->analyse.i_direct_mv_pred = atoi( optarg );                break;            case 'w':                param->analyse.b_weighted_bipred = 1;                break;            case OPT_ME:                if( strstr( optarg, "dia" ) )                    param->analyse.i_me_method = X264_ME_DIA;                else if( strstr( optarg, "hex" ) )                    param->analyse.i_me_method = X264_ME_HEX;                else if( strstr( optarg, "esa" ) )                    param->analyse.i_me_method = X264_ME_ESA;                else                {                    fprintf( stderr, "bad ME method `%s'\n", optarg );                    return -1;                }                break;            case OPT_MERANGE:                param->analyse.i_me_range = atoi(optarg);                break;            case 'm':                param->analyse.i_subpel_refine = atoi(optarg);                break;            case OPT_NO_CHROMA_ME:                param->analyse.b_chroma_me = 0;                break;            case OPT_LEVEL:                param->i_level_idc = atoi(optarg);                break;            case OPT_RATETOL:                param->rc.f_rate_tolerance = atof(optarg);                break;            case OPT_VBVMAXRATE:                param->rc.i_vbv_max_bitrate = atoi( optarg );                break;            case OPT_VBVBUFSIZE:                param->rc.i_vbv_buffer_size = atoi( optarg );                break;            case OPT_VBVINIT:                param->rc.f_vbv_buffer_init = atof(optarg);                break;            case OPT_IPRATIO:                param->rc.f_ip_factor = atof(optarg);                break;            case OPT_PBRATIO:                param->rc.f_pb_factor = atof(optarg);                break;            case OPT_CHROMA_QP:                param->analyse.i_chroma_qp_offset = atoi(optarg);                break;            case 'p':            {                int i_pass = atoi(optarg);                if( i_pass == 1 )                    param->rc.b_stat_write = 1;                else if( i_pass == 2 )                    param->rc.b_stat_read = 1;                else if( i_pass > 2 )                    param->rc.b_stat_read =                    param->rc.b_stat_write = 1;                break;            }            case OPT_RCSTATS:                param->rc.psz_stat_in = optarg;                param->rc.psz_stat_out = optarg;                break;            case OPT_RCEQ:                param->rc.psz_rc_eq = optarg;               break;            case OPT_QCOMP:                param->rc.f_qcompress = atof(optarg);                break;            case OPT_QBLUR:                param->rc.f_qblur = atof(optarg);                break;            case OPT_CPLXBLUR:                param->rc.f_complexity_blur = atof(optarg);                break;            case OPT_NOPSNR:                param->analyse.b_psnr = 0;                break;            case OPT_QUIET:                param->i_log_level = X264_LOG_NONE;                break;            case 'v':                param->i_log_level = X264_LOG_DEBUG;                break;            case OPT_AUD:                param->b_aud = 1;                break;            case OPT_PROGRESS:                opt->b_progress = 1;                break;            case OPT_VISUALIZE:#ifdef VISUALIZE                param->b_visualize = 1;                b_exit_on_ctrl_c = 1;#else                fprintf( stderr, "not compiled with visualization support\n" );#endif                break;            default:                fprintf( stderr, "unknown option (%c)\n", optopt );                return -1;        }    }    /* Get the file name */    if( optind > argc - 1 || !opt->hout )    {        Help( &defaults );        return -1;    }    psz_filename = argv[optind++];    if( !opt->b_decompress )    {        if( optind > argc - 1 )        {            /* try to parse the file name */            for( psz = psz_filename; *psz; psz++ )            {                if( *psz >= '0' && *psz <= '9'                    && sscanf( psz, "%ux%u", &param->i_width, &param->i_height ) == 2 )                {                    if( param->i_log_level > X264_LOG_NONE )                        fprintf( stderr, "x264: file name gives %dx%d\n", param->i_width, param->i_height );                    break;                }            }        }        else        {            sscanf( argv[optind++], "%ux%u", &param->i_width, &param->i_height );        }                /* check avis input */        psz = psz_filename + strlen(psz_filename) - 1;        while( psz > psz_filename && *psz != '.' )            psz--;        if( !strncasecmp( psz, ".avi", 4 ) || !strncasecmp( psz, ".avs", 4 ) )            b_avis = 1;        if( !b_avis && ( !param->i_width || !param->i_height ) )        {            Help( &defaults );            return -1;        }    }    /* open the input */    if( !strcmp( psz_filename, "-" ) )    {        opt->hin = stdin;        optind++;    }    else    {        if( b_avis )        {#ifdef AVIS_INPUT            p_open_infile = open_file_avis;            p_get_frame_total = get_frame_total_avis;            p_read_frame = read_frame_avis;            p_close_infile = close_file_avis;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -