gpt4 book ai didi

com.twelvemonkeys.imageio.color.YCbCrConverter.clamp()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 05:38:49 28 4
gpt4 key购买 nike

本文整理了Java中com.twelvemonkeys.imageio.color.YCbCrConverter.clamp()方法的一些代码示例,展示了YCbCrConverter.clamp()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YCbCrConverter.clamp()方法的具体详情如下:
包路径:com.twelvemonkeys.imageio.color.YCbCrConverter
类名称:YCbCrConverter
方法名:clamp

YCbCrConverter.clamp介绍

暂无

代码示例

代码示例来源:origin: haraldk/TwelveMonkeys

public static void convertYCbCr2RGB(final byte[] yCbCr, final byte[] rgb, final int offset) {
  int y = yCbCr[offset] & 0xff;
  int cr = yCbCr[offset + 2] & 0xff;
  int cb = yCbCr[offset + 1] & 0xff;
  rgb[offset] = clamp(y + Cr_R_LUT[cr]);
  rgb[offset + 1] = clamp(y + (Cb_G_LUT[cb] + Cr_G_LUT[cr] >> SCALEBITS));
  rgb[offset + 2] = clamp(y + Cb_B_LUT[cb]);
}

代码示例来源:origin: haraldk/TwelveMonkeys

public static void convertYCbCr2RGB(final byte[] yCbCr, final byte[] rgb, final double[] coefficients, double[] referenceBW, final int offset) {
  double y;
  double cb;
  double cr;
  if (referenceBW == null) {
    // Default case
    y = (yCbCr[offset] & 0xff);
    cb = (yCbCr[offset + 1] & 0xff) - 128;
    cr = (yCbCr[offset + 2] & 0xff) - 128;
  }
  else {
    // Custom values
    y = ((yCbCr[offset] & 0xff) - referenceBW[0]) * 255.0 / (referenceBW[1] - referenceBW[0]);
    cb = ((yCbCr[offset + 1] & 0xff) - referenceBW[2]) * 127.0 / (referenceBW[3] - referenceBW[2]);
    cr = ((yCbCr[offset + 2] & 0xff) - referenceBW[4]) * 127.0 / (referenceBW[5] - referenceBW[4]);
  }
  double lumaRed = coefficients[0];
  double lumaGreen = coefficients[1];
  double lumaBlue = coefficients[2];
  int red = (int) Math.round(cr * (2.0 - 2.0 * lumaRed) + y);
  int blue = (int) Math.round(cb * (2.0 - 2.0 * lumaBlue) + y);
  int green = (int) Math.round((y - lumaRed * red - lumaBlue * blue) / lumaGreen);
  rgb[offset] = clamp(red);
  rgb[offset + 2] = clamp(blue);
  rgb[offset + 1] = clamp(green);
}

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.imageio/imageio-core

public static void convertYCbCr2RGB(final byte[] yCbCr, final byte[] rgb, final int offset) {
  int y = yCbCr[offset] & 0xff;
  int cr = yCbCr[offset + 2] & 0xff;
  int cb = yCbCr[offset + 1] & 0xff;
  rgb[offset] = clamp(y + Cr_R_LUT[cr]);
  rgb[offset + 1] = clamp(y + (Cb_G_LUT[cb] + Cr_G_LUT[cr] >> SCALEBITS));
  rgb[offset + 2] = clamp(y + Cb_B_LUT[cb]);
}

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.imageio/imageio-core

public static void convertYCbCr2RGB(final byte[] yCbCr, final byte[] rgb, final double[] coefficients, double[] referenceBW, final int offset) {
  double y;
  double cb;
  double cr;
  if (referenceBW == null) {
    // Default case
    y = (yCbCr[offset] & 0xff);
    cb = (yCbCr[offset + 1] & 0xff) - 128;
    cr = (yCbCr[offset + 2] & 0xff) - 128;
  }
  else {
    // Custom values
    y = ((yCbCr[offset] & 0xff) - referenceBW[0]) * 255.0 / (referenceBW[1] - referenceBW[0]);
    cb = ((yCbCr[offset + 1] & 0xff) - referenceBW[2]) * 127.0 / (referenceBW[3] - referenceBW[2]);
    cr = ((yCbCr[offset + 2] & 0xff) - referenceBW[4]) * 127.0 / (referenceBW[5] - referenceBW[4]);
  }
  double lumaRed = coefficients[0];
  double lumaGreen = coefficients[1];
  double lumaBlue = coefficients[2];
  int red = (int) Math.round(cr * (2.0 - 2.0 * lumaRed) + y);
  int blue = (int) Math.round(cb * (2.0 - 2.0 * lumaBlue) + y);
  int green = (int) Math.round((y - lumaRed * red - lumaBlue * blue) / lumaGreen);
  rgb[offset] = clamp(red);
  rgb[offset + 2] = clamp(blue);
  rgb[offset + 1] = clamp(green);
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com