Java Integer Clip clipPlus128(int v)

Here you can find the source of clipPlus128(int v)

Description

Clamp, then convert signed number back to pixel value.

License

BSD License

Declaration

private static int clipPlus128(int v) 

Method Source Code

//package com.java2s;
/**/*from   ww w.j  a v a  2 s. c  o  m*/
 * This class is part of JCodec ( www.jcodec.org ) This software is distributed
 * under FreeBSD License
 * 
 * @author The JCodec project
 * 
 */

public class Main {
    /**
     *  Clamp, then convert signed number back to pixel value. 
     */
    private static int clipPlus128(int v) {
        return (int) (clipSigned(v) + 128);
    }

    private static int clipSigned(int v) {
        return (int) (v < -128 ? -128 : (v > 127 ? 127 : v));
    }
}

Related

  1. clipColor(final int compIn, final boolean allowRGB555)
  2. clipHistogram(final int[] hist, final int[] clippedHist, final int limit)
  3. clipInt(int value, int max)
  4. clipInt(int value, int min, int max)
  5. clipPeerIdFromCurrentThreadName()
  6. clipRange(int value, int lowLimit, int highLimit)
  7. clipSigned(int v)