congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Picture.getPlaneData
Code IndexAdd Tabnine to your IDE (free)

How to use
getPlaneData
method
in
org.jcodec.common.model.Picture

Best Java code snippets using org.jcodec.common.model.Picture.getPlaneData (Showing top 20 results out of 315)

origin: org.jcodec/jcodec

static void collectPredictors(DecoderState sharedState, Picture outMB, int mbX) {
  sharedState.topLeft[0][0] = sharedState.topLine[0][(mbX << 4) + 15];
  sharedState.topLeft[0][1] = outMB.getPlaneData(0)[63];
  sharedState.topLeft[0][2] = outMB.getPlaneData(0)[127];
  sharedState.topLeft[0][3] = outMB.getPlaneData(0)[191];
  arraycopy(outMB.getPlaneData(0), 240, sharedState.topLine[0], mbX << 4, 16);
  copyCol(outMB.getPlaneData(0), 16, 15, 16, sharedState.leftRow[0]);
  collectChromaPredictors(sharedState, outMB, mbX);
}
origin: org.jcodec/jcodec-javase

public static void toBufferedImage(Picture src, BufferedImage dst) {
  byte[] data = ((DataBufferByte) dst.getRaster().getDataBuffer()).getData();
  byte[] srcData = src.getPlaneData(0);
  for (int i = 0; i < data.length; i++) {
    // Unshifting, since JCodec stores [0..255] -> [-128, 127]
    data[i] = (byte) (srcData[i] + 128);
  }
}
origin: org.jcodec/jcodec

static void collectChromaPredictors(DecoderState sharedState, Picture outMB, int mbX) {
  sharedState.topLeft[1][0] = sharedState.topLine[1][(mbX << 3) + 7];
  sharedState.topLeft[2][0] = sharedState.topLine[2][(mbX << 3) + 7];
  arraycopy(outMB.getPlaneData(1), 56, sharedState.topLine[1], mbX << 3, 8);
  arraycopy(outMB.getPlaneData(2), 56, sharedState.topLine[2], mbX << 3, 8);
  copyCol(outMB.getPlaneData(1), 8, 7, 8, sharedState.leftRow[1]);
  copyCol(outMB.getPlaneData(2), 8, 7, 8, sharedState.leftRow[2]);
}
origin: org.jcodec/jcodec-javase

public static void fromBufferedImage(BufferedImage src, Picture dst) {
  byte[] dstData = dst.getPlaneData(0);
  int off = 0;
  for (int i = 0; i < src.getHeight(); i++) {
    for (int j = 0; j < src.getWidth(); j++) {
      int rgb1 = src.getRGB(j, i);
      dstData[off++] = (byte) (((rgb1 >> 16) & 0xff) - 128);
      dstData[off++] = (byte) (((rgb1 >> 8) & 0xff) - 128);
      dstData[off++] = (byte) ((rgb1 & 0xff) - 128);
    }
  }
}
origin: org.jcodec/jcodec

private void collectPredictors(Picture outMB, int mbX) {
  arraycopy(outMB.getPlaneData(0), 240, topLine[0], mbX << 4, 16);
  arraycopy(outMB.getPlaneData(1), 56, topLine[1], mbX << 3, 8);
  arraycopy(outMB.getPlaneData(2), 56, topLine[2], mbX << 3, 8);
  copyCol(outMB.getPlaneData(0), 15, 16, leftRow[0]);
  copyCol(outMB.getPlaneData(1), 7, 8, leftRow[1]);
  copyCol(outMB.getPlaneData(2), 7, 8, leftRow[2]);
}
origin: org.jcodec/jcodec

private void collectPredictors(Picture outMB, int mbX) {
  arraycopy(outMB.getPlaneData(0), 240, topLine[0], mbX << 4, 16);
  arraycopy(outMB.getPlaneData(1), 56, topLine[1], mbX << 3, 8);
  arraycopy(outMB.getPlaneData(2), 56, topLine[2], mbX << 3, 8);
  copyCol(outMB.getPlaneData(0), 15, 16, leftRow[0]);
  copyCol(outMB.getPlaneData(1), 7, 8, leftRow[1]);
  copyCol(outMB.getPlaneData(2), 7, 8, leftRow[2]);
}
origin: org.jcodec/jcodec

static void mergeResidual(Picture mb, int[][][] residual, int[][] blockLUT, int[][] posLUT) {
  for (int comp = 0; comp < 3; comp++) {
    byte[] to = mb.getPlaneData(comp);
    for (int i = 0; i < to.length; i++) {
      to[i] = (byte) clip(to[i] + residual[comp][blockLUT[comp][i]][posLUT[comp][i]], -128, 127);
    }
  }
}
origin: org.jcodec/jcodec

@Override
public void transform(Picture src, Picture dst) {
  int lumaSize = src.getWidth() * src.getHeight();
  arraycopy(src.getPlaneData(0), 0, dst.getPlaneData(0), 0, lumaSize);
  copyAvg(src.getPlaneData(1), dst.getPlaneData(1), src.getPlaneWidth(1), src.getPlaneHeight(1));
  copyAvg(src.getPlaneData(2), dst.getPlaneData(2), src.getPlaneWidth(2), src.getPlaneHeight(2));
}
origin: org.jcodec/jcodec

@Override
public Picture decodeFrame(ByteBuffer data, byte[][] buffer) {
  Picture create = Picture.createPicture(width, height, buffer, ColorSpace.YUV420);
  ByteBuffer pix = data.duplicate();
  copy(pix, create.getPlaneData(0), width * height);
  copy(pix, create.getPlaneData(1), width * height / 4);
  copy(pix, create.getPlaneData(2), width * height / 4);
  return create;
}
origin: org.jcodec/jcodec

@Override
public void transform(Picture src, Picture dst) {
  copy(src.getPlaneData(0), dst.getPlaneData(0), src.getWidth(), dst.getWidth(), dst.getHeight());
  _copy(src.getPlaneData(1), dst.getPlaneData(1), 0, 0, 1, 2, src.getWidth() >> 1, dst.getWidth() >> 1,
      src.getHeight() >> 1, dst.getHeight());
  _copy(src.getPlaneData(1), dst.getPlaneData(1), 0, 1, 1, 2, src.getWidth() >> 1, dst.getWidth() >> 1,
      src.getHeight() >> 1, dst.getHeight());
  _copy(src.getPlaneData(2), dst.getPlaneData(2), 0, 0, 1, 2, src.getWidth() >> 1, dst.getWidth() >> 1,
      src.getHeight() >> 1, dst.getHeight());
  _copy(src.getPlaneData(2), dst.getPlaneData(2), 0, 1, 1, 2, src.getWidth() >> 1, dst.getWidth() >> 1,
      src.getHeight() >> 1, dst.getHeight());
}
origin: org.jcodec/jcodec

public void predictMB(Picture ref, int refX, int vectX, int refY, int vectY, int blkW, int blkH, int refVertStep,
    int refVertOff, int[][] tgt, int tgtY, int tgtVertStep) {
  int ch = chromaFormat == Chroma420 ? 1 : 0;
  int cw = chromaFormat == Chroma444 ? 0 : 1;
  int sh = chromaFormat == Chroma420 ? 2 : 1;
  int sw = chromaFormat == Chroma444 ? 1 : 2;
  predictPlane(ref.getPlaneData(0), refX + vectX, refY + vectY, ref.getPlaneWidth(0), ref.getPlaneHeight(0),
      refVertStep, refVertOff, tgt[0], tgtY, blkW, blkH, tgtVertStep);
  predictPlane(ref.getPlaneData(1), (refX >> cw) + vectX / sw, (refY >> ch) + vectY / sh, ref.getPlaneWidth(1),
      ref.getPlaneHeight(1), refVertStep, refVertOff, tgt[1], tgtY, blkW >> cw, blkH >> ch, tgtVertStep);
  predictPlane(ref.getPlaneData(2), (refX >> cw) + vectX / sw, (refY >> ch) + vectY / sh, ref.getPlaneWidth(2),
      ref.getPlaneHeight(2), refVertStep, refVertOff, tgt[2], tgtY, blkW >> cw, blkH >> ch, tgtVertStep);
}
origin: org.jcodec/jcodec

void decodeBlock(BitReader bits, int[] dcPredictor, int[][] quant, VLC[] huff, Picture result, int[] buf,
    int blkX, int blkY, int plane, int chroma, int field, int step) {
  Arrays.fill(buf, 0);
  dcPredictor[plane] = buf[0] = readDCValue(bits, huff[chroma]) * quant[chroma][0] + dcPredictor[plane];
  readACValues(bits, buf, huff[chroma + 2], quant[chroma]);
  SimpleIDCT10Bit.idct10(buf, 0);
  putBlock(result.getPlaneData(plane), result.getPlaneWidth(plane), buf, blkX, blkY, field, step);
}
origin: org.jcodec/jcodec

public static final void putBlkPic(Picture dest, Picture src, int x, int y) {
  if (dest.getColor() != src.getColor())
    throw new RuntimeException("Incompatible color");
  for (int c = 0; c < dest.getColor().nComp; c++) {
    pubBlkOnePlane(dest.getPlaneData(c), dest.getPlaneWidth(c), src.getPlaneData(c), src.getPlaneWidth(c),
        src.getPlaneHeight(c), x >> dest.getColor().compWidth[c], y >> dest.getColor().compHeight[c]);
  }
}
origin: org.jcodec/jcodec

private int[][] transformChroma(Picture pic, int comp, int qp, int x, int y, Picture outMB, int chromaPred) {
  int[][] ac = new int[4][16];
  for (int blk = 0; blk < ac.length; blk++) {
    int blkOffX = (blk & 1) << 2;
    int blkOffY = (blk >> 1) << 2;
    takeSubtract(pic.getPlaneData(comp), pic.getPlaneWidth(comp), pic.getPlaneHeight(comp), x + blkOffX, y
        + blkOffY, ac[blk], chromaPred);
    VPXDCT.fdct4x4(ac[blk]);
  }
  return ac;
}
origin: org.jcodec/jcodec

private int[] mvEstimate(Picture pic, int mbX, int mbY, int mvpx, int mvpy) {
  byte[] patch = new byte[256];
  MBEncoderHelper.take(pic.getPlaneData(0), pic.getPlaneWidth(0), pic.getPlaneHeight(0), mbX << 4, mbY << 4,
      patch, 16, 16);
  return me.estimate(ref, patch, mbX, mbY, mvpx, mvpy);
}
origin: org.jcodec/jcodec

@Override
void decodeBlock(BitReader bits, int[] dcPredictor, int[][] quant, VLC[] huff, Picture result, int[] buf, int blkX,
    int blkY, int plane, int chroma, int field, int step) {
  buf[1] = buf[2] = buf[3] = buf[4] = buf[5] = buf[6] = buf[7] = buf[8] = buf[9] = buf[10] = buf[11] = buf[12] = buf[13] = buf[14] = buf[15] = 0;
  dcPredictor[plane] = buf[0] = readDCValue(bits, huff[chroma]) * quant[chroma][0] + dcPredictor[plane];
  readACValues(bits, buf, huff[chroma + 2], quant[chroma]);
  IDCT4x4.idct(buf, 0);
  putBlock4x4(result.getPlaneData(plane), result.getPlaneWidth(plane), buf, blkX, blkY, field, step);
}
origin: org.jcodec/jcodec

@Override
void decodeBlock(BitReader bits, int[] dcPredictor, int[][] quant, VLC[] huff, Picture result, int[] buf,
    int blkX, int blkY, int plane, int chroma, int field, int step) {
  buf[1] = buf[2] = buf[3] = 0;
  dcPredictor[plane] = buf[0] = readDCValue(bits, huff[chroma]) * quant[chroma][0] + dcPredictor[plane];
  readACValues(bits, buf, huff[chroma + 2], quant[chroma]);
  IDCT2x2.idct(buf, 0);
  putBlock2x2(result.getPlaneData(plane), result.getPlaneWidth(plane), buf, blkX, blkY, field, step);
}
origin: org.jcodec/jcodec

private int[][] transform(Picture pic, int comp, int qp, int x, int y) {
  int dcc = lumaDCPred(x, y);
  int[][] ac = new int[16][16];
  for (int i = 0; i < ac.length; i++) {
    int[] coeff = ac[i];
    int blkOffX = (i & 3) << 2;
    int blkOffY = i & ~3;
    takeSubtract(pic.getPlaneData(comp), pic.getPlaneWidth(comp), pic.getPlaneHeight(comp), x + blkOffX, y
        + blkOffY, coeff, dcc);
    VPXDCT.fdct4x4(coeff);
  }
  return ac;
}
origin: org.jcodec/jcodec

private void luma(Picture pic, int mbX, int mbY, VPXBooleanEncoder out, int qp, Picture outMB) {
  int x = mbX << 4;
  int y = mbY << 4;
  int[][] ac = transform(pic, 0, qp, x, y);
  int[] dc = extractDC(ac);
  writeLumaDC(mbX, mbY, out, qp, dc);
  writeLumaAC(mbX, mbY, out, ac, qp);
  restorePlaneLuma(dc, ac, qp);
  putLuma(outMB.getPlaneData(0), lumaDCPred(x, y), ac, 4);
}
origin: org.jcodec/jcodec

  public static void subImageWithFillPic8(Picture _in, Picture out, Rect rect) {
    int width = _in.getWidth();
    int height = _in.getHeight();
    ColorSpace color = _in.getColor();
    byte[][] data = _in.getData();

    for (int i = 0; i < data.length; i++) {
      subImageWithFill(data[i], width >> color.compWidth[i], height >> color.compHeight[i],
          out.getPlaneData(i), rect.getWidth() >> color.compWidth[i],
          rect.getHeight() >> color.compHeight[i], rect.getX() >> color.compWidth[i],
          rect.getY() >> color.compHeight[i]);
    }
  }
}
org.jcodec.common.modelPicturegetPlaneData

Popular methods of Picture

  • getData
  • getHeight
  • getWidth
  • create
  • getColor
  • createCropped
  • createPicture
  • cropped
  • getCrop
  • getCroppedHeight
  • getCroppedWidth
  • <init>
  • getCroppedWidth,
  • <init>,
  • compatible,
  • copyFrom,
  • createCompatible,
  • createCroppedHiBD,
  • cropNeeded,
  • cropSub,
  • fill

Popular in Java

  • Reactive rest calls using spring rest template
  • putExtra (Intent)
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Table (org.hibernate.mapping)
    A relational table
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now