Просмотр исходного кода

YCbCr planes only need to be 8bit, clamped

Dominic Szablewski 12 лет назад
Родитель
Сommit
170a24e110
2 измененных файлов: 9 добавлений и 9 удалений
  1. 0 0
      README.md
  2. 9 9
      jsmpg.js

+ 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;