[x265] [PATCH] refactor: (common files)check need of signed/unsigned int

Steve Borho steve at borho.org
Thu Oct 31 20:20:54 CET 2013


<snipped>

diff -r 0666d56aaa42 -r b7f2aac2b3fe source/x265.h
> --- a/source/x265.h     Mon Oct 28 16:13:05 2013 +0530
> +++ b/source/x265.h     Thu Oct 31 14:33:52 2013 +0530
> @@ -130,7 +130,7 @@
>  typedef struct
>  {
>      void*   planes[3];
> -    int     stride[3];
> +    intptr_t stride[3];
>      int     bitDepth;
>      int     sliceType;
>      int     poc;
> @@ -245,18 +245,18 @@
>  typedef struct
>  {
>      int       logLevel;
> -    int       bEnableWavefront;                ///< enable wavefront
> parallel processing
> -    int       poolNumThreads;                  ///< number of threads to
> allocate for thread pool
> -    int       frameNumThreads;                 ///< number of
> concurrently encoded frames
> +    uint32_t       bEnableWavefront;                ///< enable wavefront
> parallel processing
> +    uint32_t       poolNumThreads;                  ///< number of
> threads to allocate for thread pool
> +    uint32_t       frameNumThreads;                 ///< number of
> concurrently encoded frames
>
> -    int       internalBitDepth;                ///< bit-depth at which
> the encoder operates
> +    uint32_t       internalBitDepth;                ///< bit-depth at
> which the encoder operates
>
>      const char *csvfn;                         ///< csv log filename.
> logLevel >= 3 is frame logging, else one line per run
>
>      // source specification
> -    int       frameRate;                       ///< source frame-rate in
> Hz
> -    int       sourceWidth;                     ///< source width in pixels
> -    int       sourceHeight;                    ///< source height in
> pixels
> +    uint32_t       frameRate;                       ///< source
> frame-rate in Hz
> +    uint32_t       sourceWidth;                     ///< source width in
> pixels
> +    uint32_t       sourceHeight;                    ///< source height in
> pixels
>
>      // coding unit (CU) definition
>      uint32_t  maxCUSize;                       ///< max. CU width and
> height in pixels
> @@ -265,60 +265,60 @@
>      uint32_t  tuQTMaxIntraDepth;               ///< amount the TU is
> allow to recurse beyond the intra PU depth
>
>      // coding structure
> -    int       decodingRefreshType;             ///< Intra refresh type
> (0:none, 1:CDR, 2:IDR) default: 1
> +    uint32_t       decodingRefreshType;             ///< Intra refresh
> type (0:none, 1:CDR, 2:IDR) default: 1
>      int       keyframeMin;                     ///< Minimum intra period
> in frames
>      int       keyframeMax;                     ///< Maximum intra period
> in frames
>      int       bOpenGOP;                        ///< Enable Open GOP
> referencing
>      int       bframes;                         ///< Max number of
> consecutive B-frames
>      int       lookaheadDepth;                  ///< Number of frames to
> use for lookahead, determines encoder latency
> -    int       bFrameAdaptive;                  ///< 0 - none, 1 - fast, 2
> - full (trellis) adaptive B frame scheduling
> +    uint32_t       bFrameAdaptive;                  ///< 0 - none, 1 -
> fast, 2 - full (trellis) adaptive B frame scheduling
>      int       bFrameBias;
>      int       scenecutThreshold;               ///< how aggressively to
> insert extra I frames
>
>      // Intra coding tools
> -    int       bEnableConstrainedIntra;         ///< enable constrained
> intra prediction (ignore inter predicted reference samples)
> -    int       bEnableStrongIntraSmoothing;     ///< enable strong intra
> smoothing for 32x32 blocks where the reference samples are flat
> +    uint32_t       bEnableConstrainedIntra;         ///< enable
> constrained intra prediction (ignore inter predicted reference samples)
> +    uint32_t       bEnableStrongIntraSmoothing;     ///< enable strong
> intra smoothing for 32x32 blocks where the reference samples are flat
>
>      // Inter coding tools
> -    int       searchMethod;                    ///< ME search method
> (DIA, HEX, UMH, STAR, FULL)
> -    int       subpelRefine;                    ///< amount of subpel work
> to perform (0 .. X265_MAX_SUBPEL_LEVEL)
> -    int       searchRange;                     ///< ME search range
> +    uint32_t       searchMethod;                    ///< ME search method
> (DIA, HEX, UMH, STAR, FULL)
> +    uint32_t       subpelRefine;                    ///< amount of subpel
> work to perform (0 .. X265_MAX_SUBPEL_LEVEL)
> +    uint32_t       searchRange;                     ///< ME search range
>      uint32_t  maxNumMergeCand;                 ///< Max number of merge
> candidates
> -    int       bEnableWeightedPred;             ///< enable weighted
> prediction in P slices
> +    uint32_t       bEnableWeightedPred;             ///< enable weighted
> prediction in P slices
>      int       bEnableWeightedBiPred;           ///< enable bi-directional
> weighted prediction in B slices
>
>      int       bEnableAMP;                      ///< enable asymmetrical
> motion predictions
> -    int       bEnableRectInter;                ///< enable rectangular
> inter modes 2NxN, Nx2N
> -    int       bEnableCbfFastMode;              ///< enable use of Cbf
> flags for fast mode decision
> +    uint32_t       bEnableRectInter;                ///< enable
> rectangular inter modes 2NxN, Nx2N
> +    uint32_t       bEnableCbfFastMode;              ///< enable use of
> Cbf flags for fast mode decision
>      int       bEnableEarlySkip;                ///< enable early skip
> (merge) detection
>      int       rdLevel;                         ///< Configure RDO work
> level
> -    int       bEnableRDO;
> -    int       bEnableRDOQ;
> -    int       bEnableSignHiding;               ///< enable hiding one
> sign bit per TU via implicit signaling
> -    int       bEnableTransformSkip;            ///< enable intra
> transform skipping
> -    int       bEnableTSkipFast;                ///< enable fast intra
> transform skipping
> +    uint32_t       bEnableRDO;
> +    uint32_t       bEnableRDOQ;
> +    uint32_t       bEnableSignHiding;               ///< enable hiding
> one sign bit per TU via implicit signaling
> +    uint32_t       bEnableTransformSkip;            ///< enable intra
> transform skipping
> +    uint32_t       bEnableTSkipFast;                ///< enable fast
> intra transform skipping
>      int       bEnableRDOQTS;                   ///< enable RD optimized
> quantization when transform skip is selected
>      int       maxNumReferences;                ///< maximum number of
> references a frame can have in L0
>
>      // loop filter
> -    int       bEnableLoopFilter;               ///< enable Loop Filter
> +    uint32_t       bEnableLoopFilter;               ///< enable Loop
> Filter
>
>      // SAO loop filter
> -    int       bEnableSAO;                      ///< enable SAO filter
> -    int       saoLcuBoundary;                  ///< SAO parameter
> estimation using non-deblocked pixels for LCU bottom and right boundary
> areas
> -    int       saoLcuBasedOptimization;         ///< SAO LCU-based
> optimization
> +    uint32_t       bEnableSAO;                      ///< enable SAO filter
> +    uint32_t       saoLcuBoundary;                  ///< SAO parameter
> estimation using non-deblocked pixels for LCU bottom and right boundary
> areas
> +    uint32_t       saoLcuBasedOptimization;         ///< SAO LCU-based
> optimization
>
>      // coding quality
>      int       cbQpOffset;                      ///< Chroma Cb QP Offset
> (0:default)
>      int       crQpOffset;                      ///< Chroma Cr QP Offset
> (0:default)
> -    int       rdPenalty;                       ///< RD-penalty for 32x32
> TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2:
> maximum RD-penalty)
> +    uint32_t       rdPenalty;                       ///< RD-penalty for
> 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2:
> maximum RD-penalty)
>
>      // debugging
> -    int       decodedPictureHashSEI;           ///<
> Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI
> message
> +    uint32_t       decodedPictureHashSEI;           ///<
> Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI
> message
>
>      // quality metrics
> -    int       bEnablePsnr;
> -    int       bEnableSsim;
> +    uint32_t       bEnablePsnr;
> +    uint32_t       bEnableSsim;
>

The boolean flags don't need to be uint32_t, nor do the small enum fields
like decodedPictureHashSEI and saoLcuBasedOptimization.  And I really don't
feel like taking a large copy/replace refactor that doesn't even try to
fixup white-space alignment.


>      struct
>      {
>          int       bitrate;
> @@ -376,7 +376,7 @@
>   *      x265_max_bit_depth is 12, the internal and input bit depths can be
>   *      either 8, 10, or 12. Note that the internal bit depth must be the
> same
>   *      for all encoders allocated in the same process. */
> -extern const int x265_max_bit_depth;
> +extern const uint32_t x265_max_bit_depth;
>
>  /* x265_version_str:
>   *      A static string containing the version of this compiled x265
> library */
>

-- 
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20131031/62734535/attachment.html>


More information about the x265-devel mailing list