浏览代码

YCbCr planes only need to be 8bit, clamped

Dominic Szablewski 12 年前
父节点
当前提交
170a24e110
共有 2 个文件被更改,包括 9 次插入9 次删除
  1. 0 0
      README.md
  2. 9 9
      jsmpg.js

+ 0 - 0
README.md 查看文件


+ 9 - 9
jsmpg.js 查看文件

@@ -226,17 +226,17 @@ jsmpeg.prototype.decodeSequenceHeader = function() {
226 226
 	this.sequenceStarted = true;
227 227
 	
228 228
 	// Allocated buffers and resize the canvas
229
-	this.currentY = new Int16Array(this.codedSize);
230
-	this.currentCr = new Int16Array(this.codedSize >> 2);
231
-	this.currentCb = new Int16Array(this.codedSize >> 2);
229
+	this.currentY = new Uint8ClampedArray(this.codedSize);
230
+	this.currentCr = new Uint8ClampedArray(this.codedSize >> 2);
231
+	this.currentCb = new Uint8ClampedArray(this.codedSize >> 2);
232 232
 	
233
-	this.forwardY = new Int16Array(this.codedSize);
234
-	this.forwardCr = new Int16Array(this.codedSize >> 2);
235
-	this.forwardCb = new Int16Array(this.codedSize >> 2);
233
+	this.forwardY = new Uint8ClampedArray(this.codedSize);
234
+	this.forwardCr = new Uint8ClampedArray(this.codedSize >> 2);
235
+	this.forwardCb = new Uint8ClampedArray(this.codedSize >> 2);
236 236
 	
237
-	this.backwardY = new Int16Array(this.codedSize);
238
-	this.backwardCr = new Int16Array(this.codedSize >> 2);
239
-	this.backwardCb = new Int16Array(this.codedSize >> 2);
237
+	this.backwardY = new Uint8ClampedArray(this.codedSize);
238
+	this.backwardCr = new Uint8ClampedArray(this.codedSize >> 2);
239
+	this.backwardCb = new Uint8ClampedArray(this.codedSize >> 2);
240 240
 	
241 241
 	this.canvas.width = this.width;
242 242
 	this.canvas.height = this.height;