GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Migrating further to 8 bit images · codice/jcodec@a420d79

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • samples/main/java/org/jcodec/samples/transcode
    • TranscodeMain.java
  • src
    • main/java/org/jcodec
      • codecs
        • h264
          • decode
            • BlockInterpolator.java
          • encode
            • MBEncoderP16x16.java
          • io/model
            • Frame.java
        • vp8
          • VP8Decoder.java
        • vpx
          • VP8Encoder.java
      • scale
        • ColorUtil.java
        • RgbToYuv420j8Bit.java
        • RgbToYuv420p8Bit.java
        • RgbToYuv422p8Bit.java
        • Yuv422pToRgb8Bit.java
        • Yuv422pToYuv420p8Bit.java
      • testing
        • VerifyTool.java
    • test/java/org/jcodec
      • Utils.java
      • codecs
        • h264
          • MBlock8x8Test.java
          • MacroblockI16x16DecodingTest.java
          • MacroblockINxNDecodingTest.java
          • MacroblockInterDecodingTest.java
          • MacroblockIntraMixedDecodingTest.java
          • conformance
            • ConformanceTestTool.java
            • RawReader.java
        • prores
          • TestProresEncoder.java
        • util
          • FrameUtil.java
          • PGMIO.java
        • vp8
          • VP8DecoderTest.java
      • containers/mkv
        • MKVFrameReadingTest.java
      • scale
        • TestRgbToYuv420.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎samples/main/java/org/jcodec/samples/transcode/TranscodeMain.java‎

Copy file name to clipboardExpand all lines: samples/main/java/org/jcodec/samples/transcode/TranscodeMain.java
+98-95Lines changed: 98 additions & 95 deletions
Large diffs are not rendered by default.
Collapse file

‎src/main/java/org/jcodec/codecs/h264/decode/BlockInterpolator.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/jcodec/codecs/h264/decode/BlockInterpolator.java
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import static java.lang.System.arraycopy;
44
import static org.jcodec.common.tools.MathUtil.clip;
55

6-
import org.jcodec.codecs.aac.blocks.Block;
76
import org.jcodec.common.model.Picture8Bit;
87

98
/**
Collapse file

‎src/main/java/org/jcodec/codecs/h264/encode/MBEncoderP16x16.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/jcodec/codecs/h264/encode/MBEncoderP16x16.java
+11-12Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import static org.jcodec.codecs.h264.H264Const.MB_BLK_OFF_TOP;
77
import static org.jcodec.codecs.h264.io.model.MBType.P_16x16;
88

9-
import java.util.Arrays;
10-
119
import org.jcodec.codecs.h264.H264Const;
1210
import org.jcodec.codecs.h264.decode.BlockInterpolator;
1311
import org.jcodec.codecs.h264.decode.CoeffTransformer;
@@ -16,9 +14,10 @@
1614
import org.jcodec.codecs.h264.io.model.SeqParameterSet;
1715
import org.jcodec.codecs.h264.io.write.CAVLCWriter;
1816
import org.jcodec.common.io.BitWriter;
19-
import org.jcodec.common.model.Picture;
2017
import org.jcodec.common.model.Picture8Bit;
2118

19+
import java.util.Arrays;
20+
2221
/**
2322
* This class is part of JCodec ( www.jcodec.org ) This software is distributed
2423
* under FreeBSD License
@@ -80,7 +79,7 @@ public void encodeMacroblock(Picture8Bit pic, int mbX, int mbY, BitWriter out, E
8079
CAVLCWriter.writeSE(out, mv[1] - mvpy); // mvdy
8180

8281
Picture8Bit mbRef = Picture8Bit.create(16, 16, sps.chroma_format_idc);
83-
Picture mb = Picture.create(16, 16, sps.chroma_format_idc);
82+
int[][] mb = new int[][] {new int[256], new int[256 >> (cw + ch)], new int[256 >> (cw + ch)]};
8483

8584
interpolator.getBlockLuma(ref, mbRef, 0, (mbX << 6) + mv[0], (mbY << 6) + mv[1], 16, 16);
8685

@@ -90,25 +89,25 @@ public void encodeMacroblock(Picture8Bit pic, int mbX, int mbY, BitWriter out, E
9089
mbRef.getPlaneData(2), 0, mbRef.getPlaneWidth(2), (mbX << 6) + mv[0], (mbY << 6) + mv[1], 8, 8);
9190

9291
MBEncoderHelper.takeSubtract(pic.getPlaneData(0), pic.getPlaneWidth(0), pic.getPlaneHeight(0), mbX << 4,
93-
mbY << 4, mb.getPlaneData(0), mbRef.getPlaneData(0), 16, 16);
92+
mbY << 4, mb[0], mbRef.getPlaneData(0), 16, 16);
9493
MBEncoderHelper.takeSubtract(pic.getPlaneData(1), pic.getPlaneWidth(1), pic.getPlaneHeight(1), mbX << (4 - cw),
95-
mbY << (4 - ch), mb.getPlaneData(1), mbRef.getPlaneData(1), 16 >> cw, 16 >> ch);
94+
mbY << (4 - ch), mb[1], mbRef.getPlaneData(1), 16 >> cw, 16 >> ch);
9695
MBEncoderHelper.takeSubtract(pic.getPlaneData(2), pic.getPlaneWidth(2), pic.getPlaneHeight(2), mbX << (4 - cw),
97-
mbY << (4 - ch), mb.getPlaneData(2), mbRef.getPlaneData(2), 16 >> cw, 16 >> ch);
96+
mbY << (4 - ch), mb[2], mbRef.getPlaneData(2), 16 >> cw, 16 >> ch);
9897

9998
int codedBlockPattern = getCodedBlockPattern();
10099
CAVLCWriter.writeUE(out, H264Const.CODED_BLOCK_PATTERN_INTER_COLOR_INV[codedBlockPattern]);
101100

102101
CAVLCWriter.writeSE(out, qpDelta);
103102

104-
luma(pic, mb.getPlaneData(0), mbX, mbY, out, qp, outMB.getNc());
105-
chroma(pic, mb.getPlaneData(1), mb.getPlaneData(2), mbX, mbY, out, qp);
103+
luma(pic, mb[0], mbX, mbY, out, qp, outMB.getNc());
104+
chroma(pic, mb[1], mb[2], mbX, mbY, out, qp);
106105

107-
MBEncoderHelper.putBlk(outMB.getPixels().getPlaneData(0), mb.getPlaneData(0), mbRef.getPlaneData(0), 4, 0, 0,
106+
MBEncoderHelper.putBlk(outMB.getPixels().getPlaneData(0), mb[0], mbRef.getPlaneData(0), 4, 0, 0,
108107
16, 16);
109-
MBEncoderHelper.putBlk(outMB.getPixels().getPlaneData(1), mb.getPlaneData(1), mbRef.getPlaneData(1), 4 - cw, 0,
108+
MBEncoderHelper.putBlk(outMB.getPixels().getPlaneData(1), mb[1], mbRef.getPlaneData(1), 4 - cw, 0,
110109
0, 16 >> cw, 16 >> ch);
111-
MBEncoderHelper.putBlk(outMB.getPixels().getPlaneData(2), mb.getPlaneData(2), mbRef.getPlaneData(2), 4 - cw, 0,
110+
MBEncoderHelper.putBlk(outMB.getPixels().getPlaneData(2), mb[2], mbRef.getPlaneData(2), 4 - cw, 0,
112111
0, 16 >> cw, 16 >> ch);
113112

114113
Arrays.fill(outMB.getMx(), mv[0]);
Collapse file

‎src/main/java/org/jcodec/codecs/h264/io/model/Frame.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/jcodec/codecs/h264/io/model/Frame.java
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package org.jcodec.codecs.h264.io.model;
22

3-
import java.util.Comparator;
4-
53
import org.jcodec.common.model.ColorSpace;
6-
import org.jcodec.common.model.Picture;
74
import org.jcodec.common.model.Picture8Bit;
85
import org.jcodec.common.model.Rect;
96

7+
import java.util.Comparator;
8+
109
/**
1110
* This class is part of JCodec ( www.jcodec.org ) This software is distributed
1211
* under FreeBSD License
Collapse file

‎src/main/java/org/jcodec/codecs/vp8/VP8Decoder.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/jcodec/codecs/vp8/VP8Decoder.java
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
import static org.jcodec.codecs.vp8.VP8Util.keyFrameYModeTree;
1111
import static org.jcodec.codecs.vp8.VP8Util.vp8CoefUpdateProbs;
1212

13-
import java.io.IOException;
14-
import java.nio.ByteBuffer;
15-
1613
import org.jcodec.api.NotSupportedException;
1714
import org.jcodec.codecs.vp8.Macroblock.Subblock;
1815
import org.jcodec.codecs.vp8.VP8Util.QuantizationParams;
1916
import org.jcodec.codecs.vp8.VP8Util.SubblockConstants;
2017
import org.jcodec.common.Assert;
2118
import org.jcodec.common.model.ColorSpace;
22-
import org.jcodec.common.model.Picture;
19+
import org.jcodec.common.model.Picture8Bit;
20+
21+
import java.io.IOException;
22+
import java.nio.ByteBuffer;
2323

2424
/**
2525
* This class is part of JCodec ( www.jcodec.org ) This software is distributed
@@ -211,14 +211,14 @@ public void decode(ByteBuffer frame) throws IOException {
211211

212212
}
213213

214-
public Picture getPicture() {
215-
Picture p = Picture.create(width, height, ColorSpace.YUV420);
214+
public Picture8Bit getPicture8Bit() {
215+
Picture8Bit p = Picture8Bit.create(width, height, ColorSpace.YUV420);
216216

217-
int[] luma = p.getPlaneData(0);
217+
byte[] luma = p.getPlaneData(0);
218218
// int strideLuma = p.getPlaneWidth(0);
219219

220-
int[] cb = p.getPlaneData(1);
221-
int[] cr = p.getPlaneData(2);
220+
byte[] cb = p.getPlaneData(1);
221+
byte[] cr = p.getPlaneData(2);
222222
// int strideChroma = p.getPlaneWidth(1);
223223
int mbWidth = getMacroblockCount(width);
224224
int mbHeight = getMacroblockCount(height);
@@ -239,7 +239,7 @@ public Picture getPicture() {
239239
continue;
240240

241241
int yy = mb.ySubblocks[lumaRow][lumaCol].val[lumaPRow * 4 + lumaPCol];
242-
luma[strideLuma * y + x] = yy;
242+
luma[strideLuma * y + x] = (byte)(yy - 128);
243243
}
244244

245245
for (int chromaRow = 0; chromaRow < 2; chromaRow++)
@@ -253,8 +253,8 @@ public Picture getPicture() {
253253

254254
int u = mb.uSubblocks[chromaRow][chromaCol].val[chromaPRow * 4 + chromaPCol];
255255
int v = mb.vSubblocks[chromaRow][chromaCol].val[chromaPRow * 4 + chromaPCol];
256-
cb[strideChroma * y + x] = u;
257-
cr[strideChroma * y + x] = v;
256+
cb[strideChroma * y + x] = (byte)(u - 128);
257+
cr[strideChroma * y + x] = (byte)(v - 128);
258258
}
259259
}
260260
}
Collapse file

‎src/main/java/org/jcodec/codecs/vpx/VP8Encoder.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/jcodec/codecs/vpx/VP8Encoder.java
+43-48Lines changed: 43 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
import static java.lang.System.arraycopy;
44
import static org.jcodec.common.tools.MathUtil.clip;
55

6-
import java.nio.ByteBuffer;
7-
import java.nio.ByteOrder;
8-
import java.util.Arrays;
9-
106
import org.jcodec.codecs.common.biari.VPxBooleanEncoder;
117
import org.jcodec.common.ArrayUtil;
128
import org.jcodec.common.VideoEncoder;
139
import org.jcodec.common.model.ColorSpace;
14-
import org.jcodec.common.model.Picture;
1510
import org.jcodec.common.model.Picture8Bit;
1611
import org.jcodec.common.tools.MathUtil;
1712

13+
import java.nio.ByteBuffer;
14+
import java.nio.ByteOrder;
15+
import java.util.Arrays;
16+
1817
/**
1918
* This class is part of JCodec ( www.jcodec.org ) This software is distributed
2019
* under FreeBSD License
@@ -25,8 +24,8 @@
2524
public class VP8Encoder extends VideoEncoder {
2625

2726
private VPXBitstream bitstream;
28-
private int[][] leftRow;
29-
private int[][] topLine;
27+
private byte[][] leftRow;
28+
private byte[][] topLine;
3029
private VPXQuantizer quantizer;
3130
private int[] tmp;
3231
private RateControl rc;
@@ -43,22 +42,23 @@ public VP8Encoder(RateControl rc) {
4342
this.tmp = new int[16];
4443
}
4544

46-
public ByteBuffer encodeFrame(Picture pic, ByteBuffer _buf) {
45+
@Override
46+
public ByteBuffer encodeFrame8Bit(Picture8Bit pic, ByteBuffer _buf) {
4747
ByteBuffer out = _buf.duplicate();
4848
int mbWidth = ((pic.getWidth() + 15) >> 4);
4949
int mbHeight = ((pic.getHeight() + 15) >> 4);
5050

5151
prepareBuffers(mbWidth, mbHeight);
5252

5353
bitstream = new VPXBitstream(VPXConst.tokenDefaultBinProbs, mbWidth);
54-
leftRow = new int[][] { new int[16], new int[8], new int[8] };
55-
topLine = new int[][] { new int[mbWidth << 4], new int[mbWidth << 3], new int[mbWidth << 3] };
56-
initValue(leftRow, 129);
57-
initValue(topLine, 127);
54+
leftRow = new byte[][] { new byte[16], new byte[8], new byte[8] };
55+
topLine = new byte[][] { new byte[mbWidth << 4], new byte[mbWidth << 3], new byte[mbWidth << 3] };
56+
initValue(leftRow, (byte)1);
57+
initValue(topLine, (byte)-1);
5858

5959
quantizer = new VPXQuantizer();
6060

61-
Picture outMB = Picture.create(16, 16, ColorSpace.YUV420);
61+
Picture8Bit outMB = Picture8Bit.create(16, 16, ColorSpace.YUV420);
6262

6363
int[] segmentQps = rc.getSegmentQps();
6464

@@ -68,7 +68,7 @@ public ByteBuffer encodeFrame(Picture pic, ByteBuffer _buf) {
6868

6969
// MB residuals
7070
for (int mbY = 0, mbAddr = 0; mbY < mbHeight; mbY++) {
71-
initValue(leftRow, 129);
71+
initValue(leftRow, (byte)1);
7272

7373
for (int mbX = 0; mbX < mbWidth; mbX++, mbAddr++) {
7474

@@ -161,7 +161,7 @@ private int[] calcSegmentProbs(int[] segmentMap) {
161161
return result;
162162
}
163163

164-
private void initValue(int[][] leftRow2, int val) {
164+
private void initValue(byte[][] leftRow2, byte val) {
165165
Arrays.fill(leftRow2[0], val);
166166
Arrays.fill(leftRow2[1], val);
167167
Arrays.fill(leftRow2[2], val);
@@ -244,7 +244,7 @@ private void writeHeader(ByteBuffer out, int width, int height, int firstPart) {
244244
out.putShort((short) height);
245245
}
246246

247-
private void collectPredictors(Picture outMB, int mbX) {
247+
private void collectPredictors(Picture8Bit outMB, int mbX) {
248248
arraycopy(outMB.getPlaneData(0), 240, topLine[0], mbX << 4, 16);
249249
arraycopy(outMB.getPlaneData(1), 56, topLine[1], mbX << 3, 8);
250250
arraycopy(outMB.getPlaneData(2), 56, topLine[2], mbX << 3, 8);
@@ -254,14 +254,14 @@ private void collectPredictors(Picture outMB, int mbX) {
254254
copyCol(outMB.getPlaneData(2), 7, 8, leftRow[2]);
255255
}
256256

257-
private void copyCol(int[] planeData, int off, int stride, int[] out) {
257+
private void copyCol(byte[] planeData, int off, int stride, byte[] out) {
258258
for (int i = 0; i < out.length; i++) {
259259
out[i] = planeData[off];
260260
off += stride;
261261
}
262262
}
263263

264-
private void luma(Picture pic, int mbX, int mbY, VPxBooleanEncoder out, int qp, Picture outMB) {
264+
private void luma(Picture8Bit pic, int mbX, int mbY, VPxBooleanEncoder out, int qp, Picture8Bit outMB) {
265265
int x = mbX << 4;
266266
int y = mbY << 4;
267267
int[][] ac = transform(pic, 0, qp, x, y);
@@ -299,7 +299,7 @@ private int[] zigzag(int[] zz, int[] tmp2) {
299299
return tmp2;
300300
}
301301

302-
private void chroma(Picture pic, int mbX, int mbY, VPxBooleanEncoder boolEnc, int qp, Picture outMB) {
302+
private void chroma(Picture8Bit pic, int mbX, int mbY, VPxBooleanEncoder boolEnc, int qp, Picture8Bit outMB) {
303303
int x = mbX << 3;
304304
int y = mbY << 3;
305305
int chromaPred1 = chromaPredBlk(1, x, y);
@@ -317,7 +317,7 @@ private void chroma(Picture pic, int mbX, int mbY, VPxBooleanEncoder boolEnc, in
317317
putChroma(outMB.getData()[2], 2, x, y, ac2, chromaPred2);
318318
}
319319

320-
private int[][] transformChroma(Picture pic, int comp, int qp, int x, int y, Picture outMB, int chromaPred) {
320+
private int[][] transformChroma(Picture8Bit pic, int comp, int qp, int x, int y, Picture8Bit outMB, int chromaPred) {
321321
int[][] ac = new int[4][16];
322322

323323
for (int blk = 0; blk < ac.length; blk++) {
@@ -332,22 +332,22 @@ private int[][] transformChroma(Picture pic, int comp, int qp, int x, int y, Pic
332332
return ac;
333333
}
334334

335-
private void putChroma(int[] mb, int comp, int x, int y, int[][] ac, int chromaPred) {
335+
private void putChroma(byte[] mb, int comp, int x, int y, int[][] ac, int chromaPred) {
336336
for (int blk = 0; blk < 4; blk++)
337337
putBlk(mb, chromaPred, ac[blk], 3, (blk & 1) << 2, (blk >> 1) << 2);
338338
}
339339

340-
private final int chromaPredOne(int[] pix, int x) {
341-
return (pix[x] + pix[x + 1] + pix[x + 2] + pix[x + 3] + pix[x + 4] + pix[x + 5] + pix[x + 6] + pix[x + 7] + 4) >> 3;
340+
private final byte chromaPredOne(byte[] pix, int x) {
341+
return (byte)((pix[x] + pix[x + 1] + pix[x + 2] + pix[x + 3] + pix[x + 4] + pix[x + 5] + pix[x + 6] + pix[x + 7] + 4) >> 3);
342342
}
343343

344-
private final int chromaPredTwo(int[] pix1, int[] pix2, int x, int y) {
345-
return (pix1[x] + pix1[x + 1] + pix1[x + 2] + pix1[x + 3] + pix1[x + 4] + pix1[x + 5] + pix1[x + 6]
344+
private final byte chromaPredTwo(byte[] pix1, byte[] pix2, int x, int y) {
345+
return (byte)((pix1[x] + pix1[x + 1] + pix1[x + 2] + pix1[x + 3] + pix1[x + 4] + pix1[x + 5] + pix1[x + 6]
346346
+ pix1[x + 7] + pix2[y] + pix2[y + 1] + pix2[y + 2] + pix2[y + 3] + pix2[y + 4] + pix2[y + 5]
347-
+ pix2[y + 6] + pix2[y + 7] + 8) >> 4;
347+
+ pix2[y + 6] + pix2[y + 7] + 8) >> 4);
348348
}
349349

350-
private int chromaPredBlk(int comp, int x, int y) {
350+
private byte chromaPredBlk(int comp, int x, int y) {
351351
int predY = y & 0x7;
352352
if (x != 0 && y != 0)
353353
return chromaPredTwo(leftRow[comp], topLine[comp], predY, x);
@@ -356,24 +356,24 @@ else if (x != 0)
356356
else if (y != 0)
357357
return chromaPredOne(topLine[comp], x);
358358
else
359-
return 128;
359+
return 0;
360360
}
361361

362-
private void putLuma(int[] planeData, int pred, int[][] ac, int log2stride) {
362+
private void putLuma(byte[] planeData, int pred, int[][] ac, int log2stride) {
363363
for (int blk = 0; blk < ac.length; blk++) {
364364
int blkOffX = (blk & 3) << 2;
365365
int blkOffY = blk & ~3;
366366
putBlk(planeData, pred, ac[blk], log2stride, blkOffX, blkOffY);
367367
}
368368
}
369369

370-
private void putBlk(int[] planeData, int pred, int[] block, int log2stride, int blkX, int blkY) {
370+
private void putBlk(byte[] planeData, int pred, int[] block, int log2stride, int blkX, int blkY) {
371371
int stride = 1 << log2stride;
372372
for (int line = 0, srcOff = 0, dstOff = (blkY << log2stride) + blkX; line < 4; line++) {
373-
planeData[dstOff] = clip(block[srcOff] + pred, 0, 255);
374-
planeData[dstOff + 1] = clip(block[srcOff + 1] + pred, 0, 255);
375-
planeData[dstOff + 2] = clip(block[srcOff + 2] + pred, 0, 255);
376-
planeData[dstOff + 3] = clip(block[srcOff + 3] + pred, 0, 255);
373+
planeData[dstOff] = (byte)(clip(block[srcOff] + pred, -128, 127));
374+
planeData[dstOff + 1] = (byte)(clip(block[srcOff + 1] + pred, -128, 127));
375+
planeData[dstOff + 2] = (byte)(clip(block[srcOff + 2] + pred, -128, 127));
376+
planeData[dstOff + 3] = (byte)(clip(block[srcOff + 3] + pred, -128, 127));
377377
srcOff += 4;
378378
dstOff += stride;
379379
}
@@ -404,19 +404,19 @@ private int[] extractDC(int[][] ac) {
404404
return dc;
405405
}
406406

407-
private int lumaDCPred(int x, int y) {
407+
private byte lumaDCPred(int x, int y) {
408408
if (x == 0 && y == 0)
409-
return 128;
409+
return 0;
410410

411411
if (y == 0)
412-
return (ArrayUtil.sumInt(leftRow[0]) + 8) >> 4;
412+
return (byte)((ArrayUtil.sumByte(leftRow[0]) + 8) >> 4);
413413
if (x == 0)
414-
return (ArrayUtil.sumInt3(topLine[0], x, 16) + 8) >> 4;
414+
return (byte)((ArrayUtil.sumByte3(topLine[0], x, 16) + 8) >> 4);
415415

416-
return (ArrayUtil.sumInt(leftRow[0]) + ArrayUtil.sumInt3(topLine[0], x, 16) + 16) >> 5;
416+
return (byte)((ArrayUtil.sumByte(leftRow[0]) + ArrayUtil.sumByte3(topLine[0], x, 16) + 16) >> 5);
417417
}
418418

419-
private int[][] transform(Picture pic, int comp, int qp, int x, int y) {
419+
private int[][] transform(Picture8Bit pic, int comp, int qp, int x, int y) {
420420
int dcc = lumaDCPred(x, y);
421421

422422
int[][] ac = new int[16][16];
@@ -431,15 +431,15 @@ private int[][] transform(Picture pic, int comp, int qp, int x, int y) {
431431
return ac;
432432
}
433433

434-
private final void takeSubtract(int[] planeData, int planeWidth, int planeHeight, int x, int y, int[] coeff, int dc) {
434+
private final void takeSubtract(byte[] planeData, int planeWidth, int planeHeight, int x, int y, int[] coeff, int dc) {
435435
if (x + 4 < planeWidth && y + 4 < planeHeight)
436436
takeSubtractSafe(planeData, planeWidth, planeHeight, x, y, coeff, dc);
437437
else
438438
takeSubtractUnsafe(planeData, planeWidth, planeHeight, x, y, coeff, dc);
439439

440440
}
441441

442-
private final void takeSubtractSafe(int[] planeData, int planeWidth, int planeHeight, int x, int y, int[] coeff,
442+
private final void takeSubtractSafe(byte[] planeData, int planeWidth, int planeHeight, int x, int y, int[] coeff,
443443
int dc) {
444444
for (int i = 0, srcOff = y * planeWidth + x, dstOff = 0; i < 4; i++, srcOff += planeWidth, dstOff += 4) {
445445
coeff[dstOff] = planeData[srcOff] - dc;
@@ -449,7 +449,7 @@ private final void takeSubtractSafe(int[] planeData, int planeWidth, int planeHe
449449
}
450450
}
451451

452-
private final void takeSubtractUnsafe(int[] planeData, int planeWidth, int planeHeight, int x, int y, int[] coeff,
452+
private final void takeSubtractUnsafe(byte[] planeData, int planeWidth, int planeHeight, int x, int y, int[] coeff,
453453
int dc) {
454454
int outOff = 0;
455455

@@ -478,9 +478,4 @@ private final void takeSubtractUnsafe(int[] planeData, int planeWidth, int plane
478478
public ColorSpace[] getSupportedColorSpaces() {
479479
return new ColorSpace[] { ColorSpace.YUV420J };
480480
}
481-
482-
@Override
483-
public ByteBuffer encodeFrame8Bit(Picture8Bit pic, ByteBuffer _out) {
484-
throw new RuntimeException("Unsupported");
485-
}
486481
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.