Changeset 21ae55dcaa809e0f5e6b6e424a6ce2f77966ad19

Show
Ignore:
Timestamp:
19/08/06 23:32:19 (2 years ago)
Author:
Dennis van Amerongen <trax@videolan.org>
git-committer:
Dennis van Amerongen <trax@videolan.org> 1156023139 +0000
git-parent:

[3189c99ddc42c7e0b4289b28d1efc99d67c1167e]

git-author:
Dennis van Amerongen <trax@videolan.org> 1156023139 +0000
Message:

* modules/codec/x264.c: cosmetics and added SSIM stats computation option.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/codec/x264.c

    rc10879d r21ae55d  
    4444#define KEYINT_TEXT N_("Maximum GOP size") 
    4545#define KEYINT_LONGTEXT N_( "Sets maximum interval between IDR-frames." \ 
    46   "Larger values save bits, thus improving quality for a given bitrate at " \ 
    47   "the cost of seeking precision." ) 
     46    "Larger values save bits, thus improving quality for a given bitrate at " \ 
     47    "the cost of seeking precision." ) 
    4848 
    4949#define MIN_KEYINT_TEXT N_("Minimum GOP size") 
     
    5151    "In H.264, I-frames do not necessarily bound a closed GOP because it is " \ 
    5252    "allowable for a P-frame to be predicted from more frames than just the " \ 
    53     "one frame before it (also see frameref). Therefore, I-frames are not " \ 
    54     "necessarily seekable. IDR-Frames restrict subsequent P-frames from " \ 
    55     "referring to any frame prior to the IDR-Frame. \n" \ 
     53    "one frame before it (also see reference frame option). Therefore, " \ 
     54    "I-frames are not necessarily seekable. IDR-frames restrict subsequent " \ 
     55    "P-frames from referring to any frame prior to the IDR-frame. \n" \ 
    5656    "If scenecuts appear within this interval, they are still encoded as " \ 
    5757    "I-frames, but do not start a new GOP." ) 
    5858 
    59 #define SCENE_TEXT N_("Extra I-Frames aggressivity" ) 
     59#define SCENE_TEXT N_("Extra I-frames aggressivity" ) 
    6060#define SCENE_LONGTEXT N_( "Scene-cut detection. Controls how " \ 
    6161    "aggressively to insert extra I-frames. With small values of " \ 
     
    6565    "I-frame. Large values use more I-frames " \ 
    6666    "than necessary, thus wasting bits. -1 disables scene-cut detection, so " \ 
    67     "I-frames are be inserted only every other keyint frames, which probably " \ 
    68     "leads to ugly encoding artifacts. (1-100)." ) 
     67    "I-frames are inserted only every other keyint frames, which probably " \ 
     68    "leads to ugly encoding artifacts. Range 1 to 100." ) 
    6969 
    7070#define BFRAMES_TEXT N_("B-frames between I and P") 
    7171#define BFRAMES_LONGTEXT N_( "Number of consecutive B-frames between I and " \ 
    72     "P-frames. (1 to 16)" ) 
    73  
    74 /// \bug [String] extra space 
     72    "P-frames. Range 1 to 16." ) 
     73 
    7574#define B_ADAPT_TEXT N_("Adaptive B-frame decision") 
    7675#define B_ADAPT_LONGTEXT N_( "Force the specified number of " \ 
    77     "consecutive B-frames to be used, except possibly before an I-frame. " ) 
    78  
    79 /// \bug [String] extra space 
     76    "consecutive B-frames to be used, except possibly before an I-frame." ) 
     77 
    8078#define B_BIAS_TEXT N_("B-frames usage") 
    8179#define B_BIAS_LONGTEXT N_( "Bias the choice to use B-frames. Positive values " \ 
    82     "cause more B-frames, negative values cause less B-frames. " ) 
     80    "cause more B-frames, negative values cause less B-frames." ) 
    8381 
    8482#define BPYRAMID_TEXT N_("Keep some B-frames as references") 
     
    9088#define CABAC_LONGTEXT N_( "CABAC (Context-Adaptive Binary Arithmetic "\ 
    9189    "Coding). Slightly slows down encoding and decoding, but should save " \ 
    92     "10-15% bitrate." ) 
    93 /// \bug [String] Missing final dot 
     90    "10 to 15% bitrate." ) 
     91 
    9492#define REF_TEXT N_("Number of reference frames") 
    9593#define REF_LONGTEXT N_( "Number of previous frames used as predictors. " \ 
    9694    "This is effective in Anime, but seems to make little difference in " \ 
    9795    "live-action source material. Some decoders are unable to deal with " \ 
    98     "large frameref values. From 1 to 16" ) 
     96    "large frameref values. Range 1 to 16." ) 
    9997 
    10098#define NF_TEXT N_("Skip loop filter") 
     
    111109#define QP_LONGTEXT N_( "This selects the quantizer to use. " \ 
    112110    "Lower values result in better fidelity, but higher bitrates. 26 is a " \ 
    113     "good default value. From 0 to 51. 0 means lossless" ) 
    114  
    115 /// \bug [String] missing point 
     111    "good default value. Range 0 (lossless) to 51." ) 
     112 
    116113#define CRF_TEXT N_("Quality-based VBR") 
    117 #define CRF_LONGTEXT N_( "1-pass Quality-based VBR. From 0 to 51" ) 
     114#define CRF_LONGTEXT N_( "1-pass Quality-based VBR. Range 0 to 51." ) 
    118115 
    119116#define QPMIN_TEXT N_("Min QP") 
    120 #define QPMIN_LONGTEXT N_( "Minimum quantizer, 15/35 seems to be a useful " \ 
    121     "range." ) 
    122  
    123 /// \bug [String] typo ? Why doesn't it work in po ? 
     117#define QPMIN_LONGTEXT N_( "Minimum quantizer parameter. 15 to 35 seems to " \ 
     118    "be a useful range." ) 
     119 
    124120#define QPMAX_TEXT N_("Max QP") 
    125121#define QPMAX_LONGTEXT N_( "Maximum quantizer parameter." ) 
     
    129125 
    130126#define RATETOL_TEXT N_("Average bitrate tolerance") 
    131 #define RATETOL_LONGTEXT N_( "Allowed variance in average. " \ 
     127#define RATETOL_LONGTEXT N_( "Allowed variance in average " \ 
    132128    "bitrate (in kbits/s).") 
    133129 
    134130#define VBV_MAXRATE_TEXT N_("Max local bitrate") 
    135 #define VBV_MAXRATE_LONGTEXT N_( "Sets a maximum local bitrate in kbits/s.") 
     131#define VBV_MAXRATE_LONGTEXT N_( "Sets a maximum local bitrate (in kbits/s).") 
    136132 
    137133#define VBV_BUFSIZE_TEXT N_("VBV buffer") 
    138134#define VBV_BUFSIZE_LONGTEXT N_( "Averaging period for the maximum " \ 
    139     "local bitrate in kbits.") 
     135    "local bitrate (in kbits).") 
    140136 
    141137#define VBV_INIT_TEXT N_("Initial VBV buffer occupancy") 
    142138#define VBV_INIT_LONGTEXT N_( "Sets the initial buffer occupancy as a " \ 
    143     "fraction of the buffer size.") 
    144  
     139    "fraction of the buffer size. Range 0.0 to 1.0.") 
     140 
     141/* IP Ratio < 1 is technically valid but should never improve quality */ 
    145142#define IPRATIO_TEXT N_("QP factor between I and P") 
    146 #define IPRATIO_LONGTEXT N_( "QP factor between I and P.") 
    147  
     143#define IPRATIO_LONGTEXT N_( "QP factor between I and P. Range 1.0 to 2.0.") 
     144 
     145/* PB ratio < 1 is not valid and breaks ratecontrol */ 
    148146#define PBRATIO_TEXT N_("QP factor between P and B") 
    149 #define PBRATIO_LONGTEXT N_( "QP factor between P and B.") 
     147#define PBRATIO_LONGTEXT N_( "QP factor between P and B. Range 1.0 to 2.0.") 
    150148 
    151149#define CHROMA_QP_OFFSET_TEXT N_("QP difference between chroma and luma") 
     
    153151 
    154152#define QCOMP_TEXT N_("QP curve compression") 
    155 #define QCOMP_LONGTEXT N_( "QP curve compression. (0.0=CBR to 1.0=QCP)") 
     153#define QCOMP_LONGTEXT N_( "QP curve compression. Range 0.0 (CBR) to 1.0 (QCP).") 
    156154 
    157155#define CPLXBLUR_TEXT N_("Reduce fluctuations in QP") 
    158156#define CPLXBLUR_LONGTEXT N_( "This reduces the fluctuations in QP " \ 
    159                 "before curve compression. Temporally blurs complexity.") 
     157    "before curve compression. Temporally blurs complexity.") 
    160158 
    161159#define QBLUR_TEXT N_("Reduce fluctuations in QP") 
    162160#define QBLUR_LONGTEXT N_( "This reduces the fluctations in QP " \ 
    163                         "after curve compression. Temporally blurs quants.") 
     161    "after curve compression. Temporally blurs quants.") 
    164162 
    165163/* Analysis */ 
     
    174172    "(p4x4 requires p8x8. i8x8 requires 8x8dct).") 
    175173 
    176 /// \bug [String] Extra space 
    177174#define DIRECT_PRED_TEXT N_("Direct MV prediction mode") 
    178 #define DIRECT_PRED_LONGTEXT N_( "Direct MV prediction mode. ") 
     175#define DIRECT_PRED_LONGTEXT N_( "Direct MV prediction mode.") 
    179176 
    180177#define WEIGHTB_TEXT N_("Weighted prediction for B-frames") 
     
    191188#define MERANGE_LONGTEXT N_( "Maximum distance to search for " \ 
    192189    "motion estimation, measured from predicted position(s). " \ 
    193     "Default of 16 is good for most footage, "\ 
    194     "high motion sequences may benefit from settings between 24-32. " \ 
    195     "From 0 to 64." ) 
     190    "Default of 16 is good for most footage, high motion sequences may " \ 
     191    "benefit from settings between 24 and 32. Range 0 to 64." ) 
    196192 
    197193#define SUBME_TEXT N_("Subpixel motion estimation and partition decision " \ 
     
    214210#endif 
    215211 
    216 #define B_RDO_TEXT N_("RD based mode decision for B-frames.") 
     212#define B_RDO_TEXT N_("RD based mode decision for B-frames") 
    217213#define B_RDO_LONGTEXT N_( "RD based mode decision for B-frames. This " \ 
    218                         "requires subme 6.") 
     214    "requires subme 6 (or higher).") 
    219215 
    220216#define MIXED_REFS_TEXT N_("Decide references on a per partition basis") 
    221217#define MIXED_REFS_LONGTEXT N_( "Allows each 8x8 or 16x8 partition to " \ 
    222     "independently " \ 
    223     "select a reference frame, as opposed to only one ref per macroblock." ) 
     218    "independently select a reference frame, as opposed to only one ref " \ 
     219    "per macroblock." ) 
    224220 
    225221#define CHROMA_ME_TEXT N_("Ignore chroma in motion estimation") 
    226222#define CHROMA_ME_LONGTEXT N_( "Chroma ME for subpel and mode decision in " \ 
    227                 "P-frames.") 
     223    "P-frames.") 
    228224 
    229225#define BIME_TEXT N_("Jointly optimize both MVs in B-frames") 
     
    232228#define TRANSFORM_8X8DCT_TEXT N_("Adaptive spatial transform size") 
    233229#define TRANSFORM_8X8DCT_LONGTEXT N_( \ 
    234         "SATD-based decision for 8x8 transform in inter-MBs.") 
     230    "SATD-based decision for 8x8 transform in inter-MBs.") 
    235231 
    236232#define TRELLIS_TEXT N_("Trellis RD quantization" ) 
    237233#define TRELLIS_LONGTEXT N_( "Trellis RD quantization: \n" \ 
    238     " - 0: disabled\n" \ 
    239     " - 1: enabled only on the final encode of a MB\n" \ 
    240     " - 2: enabled on all mode decisions\n" \ 
    241     "This requires CABAC." ) 
     234    " - 0: disabled\n" \ 
     235    " - 1: enabled only on the final encode of a MB\n" \ 
     236    " - 2: enabled on all mode decisions\n" \ 
     237    "This requires CABAC." ) 
    242238 
    243239#define FAST_PSKIP_TEXT N_("Early SKIP detection on P-frames") 
     
    248244    "Eliminate dct blocks containing only a small single coefficient.") 
    249245 
     246/* Noise reduction 1 is too weak to measure, suggest at least 10 */ 
    250247#define NR_TEXT N_("Noise reduction") 
    251 #define NR_LONGTEXT N_( "Dct-domain noise reduction. Adaptive pseudo-deadzone.") 
     248#define NR_LONGTEXT N_( "Dct-domain noise reduction. Adaptive pseudo-deadzone. " \ 
     249    "10 to 1000 seems to be a useful range." ) 
    252250 
    253251/* Input/Output */ 
     
    256254#define ASM_LONGTEXT N_( "Use assembler CPU optimizations.") 
    257255 
    258 #define PSNR_TEXT N_("PSNR calculation") 
    259 #define PSNR_LONGTEXT N_( "This has no effect on actual encoding quality, "\ 
    260     "it just prevents the stats from being calculated (for speed)." ) 
     256#define PSNR_TEXT N_("PSNR computation") 
     257#define PSNR_LONGTEXT N_( "Compute and print PSNR stats. This has no effect on " \ 
     258    "the actual encoding quality." ) 
     259 
     260#define SSIM_TEXT N_("SSIM computation") 
     261#define SSIM_LONGTEXT N_( "Compute and print SSIM stats. This has no effect on " \ 
     262    "the actual encoding quality." ) 
    261263 
    262264#define QUIET_TEXT N_("Quiet mode") 
     
    385387    add_float( SOUT_CFG_PREFIX "ipratio", 1.40, NULL, IPRATIO_TEXT, 
    386388               IPRATIO_LONGTEXT, VLC_FALSE ); 
    387         change_float_range( 0, 100 ); 
     389        change_float_range( 1, 2 ); 
    388390 
    389391    add_float( SOUT_CFG_PREFIX "pbratio", 1.30, NULL, PBRATIO_TEXT, 
    390392               PBRATIO_LONGTEXT, VLC_FALSE ); 
    391         change_float_range( 0, 100 ); 
     393        change_float_range( 1, 2 ); 
    392394 
    393395#if X264_BUILD >= 23 /* r190 */ 
     
    481483    add_integer( SOUT_CFG_PREFIX "nr", 0, NULL, NR_TEXT, 
    482484                 NR_LONGTEXT, VLC_FALSE ); 
     485        change_integer_range( 0, 1000 ); 
    483486#endif 
    484487 
     
    488491              ASM_LONGTEXT, VLC_FALSE ); 
    489492 
    490     /* x264 psnr = 1 (default). disable PSNR calculation for speed. */ 
     493    /* x264 psnr = 1 (default). disable PSNR computation for speed. */ 
    491494    add_bool( SOUT_CFG_PREFIX "psnr", 0, NULL, PSNR_TEXT, 
    492495              PSNR_LONGTEXT, VLC_FALSE ); 
     496 
     497#if X264_BUILD >= 50 /* r554 */ 
     498    /* x264 ssim = 1 (default). disable SSIM computation for speed. */ 
     499    add_bool( SOUT_CFG_PREFIX "ssim", 0, NULL, SSIM_TEXT, 
     500              SSIM_LONGTEXT, VLC_FALSE ); 
     501#endif 
    493502 
    494503    add_bool( SOUT_CFG_PREFIX "quiet", 0, NULL, QUIET_TEXT, 
     
    512521    "min-keyint", "mixed-refs", "nf", "nr", "pbratio", "psnr", "qblur", 
    513522    "qp", "qcomp", "qpstep", "qpmax", "qpmin", "qp-max", "qp-min", "quiet", 
    514     "ratetol", "ref", "scenecut", "subme", "subpel", "tolerance", 
     523    "ratetol", "ref", "scenecut", "ssim", "subme", "subpel", "tolerance", 
    515524    "trellis", "verbose", "vbv-bufsize", "vbv-init", "vbv-maxrate", 
    516525    "weightb", NULL 
     
    650659    var_Get( p_enc, SOUT_CFG_PREFIX "nf", &val ); 
    651660    p_sys->param.b_deblocking_filter = !val.b_bool; 
    652      
     661 
    653662    var_Get( p_enc, SOUT_CFG_PREFIX "filter", &val ); 
    654663    if( val.psz_string ) 
     
    769778    p_sys->param.analyse.b_psnr = val.b_bool; 
    770779 
     780#if X264_BUILD >= 50 /* r554 */ 
     781    var_Get( p_enc, SOUT_CFG_PREFIX "ssim", &val ); 
     782    p_sys->param.analyse.b_ssim = val.b_bool; 
     783#endif 
     784 
    771785#if X264_BUILD >= 0x0012 
    772786    var_Get( p_enc, SOUT_CFG_PREFIX "weightb", &val ); 
     
    829843#if X264_BUILD >= 44 
    830844    var_Get( p_enc, SOUT_CFG_PREFIX "nr", &val ); 
    831     p_sys->param.analyse.i_noise_reduction = val.i_int; 
     845    if( val.i_int >= 0 && val.i_int <= 1000 ) 
     846        p_sys->param.analyse.i_noise_reduction = val.i_int; 
    832847#endif 
    833848 
     
    925940 
    926941#if X264_BUILD >= 29 
     942    /* As of r543 x264 will autodetect the number of cpus and will set 
     943       the number of threads accordingly unless ofcourse the number of 
     944       threads is explicitly specified... */ 
    927945    if( p_enc->i_threads >= 1 ) 
    928946        p_sys->param.i_threads = p_enc->i_threads;