summaryrefslogtreecommitdiff
path: root/quic.js
diff options
context:
space:
mode:
authorAric Stewart <aric@codeweavers.com>2012-09-24 10:52:48 -0500
committerJeremy White <jwhite@codeweavers.com>2012-09-24 11:03:11 -0500
commit8054befaec9d4bb2e03af1d446237a0bd32fadec (patch)
tree66eed7d0b707f8aabb4eb439dcacaea15d3ae674 /quic.js
parentbf15d1622106928eae792fee6e254173e87811de (diff)
quic: generalize QuicEncoder.prototype.decode_run
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Diffstat (limited to 'quic.js')
-rw-r--r--quic.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/quic.js b/quic.js
index 699820f..26a021f 100644
--- a/quic.js
+++ b/quic.js
@@ -775,7 +775,7 @@ QuicEncoder.prototype.quic_rgb32_uncompress_row_seg = function( prev_row, cur_ro
/* do run */
this.rgb_state.waitcnt = stopidx - i;
run_index = i;
- run_end = i + this.decode_run();
+ run_end = i + this.decode_run(this.rgb_state);
for (; i < run_end; i++) {
var pixel = i * rgb32_pixel_size;
@@ -833,7 +833,7 @@ QuicEncoder.prototype.quic_rgb32_uncompress_row_seg = function( prev_row, cur_ro
/* do run */
this.rgb_state.waitcnt = stopidx - i;
run_index = i;
- run_end = i + this.decode_run();
+ run_end = i + this.decode_run(this.rgb_state);
for (; i < run_end; i++) {
var pixel = i * rgb32_pixel_size;
@@ -875,7 +875,7 @@ QuicEncoder.prototype.quic_rgb32_uncompress_row_seg = function( prev_row, cur_ro
}
}
-QuicEncoder.prototype.decode_run = function()
+QuicEncoder.prototype.decode_run = function(state)
{
var runlen = 0;
@@ -885,11 +885,11 @@ QuicEncoder.prototype.decode_run = function()
var temp = zeroLUT[x];
for (hits = 1; hits <= temp; hits++) {
- runlen += this.rgb_state.melcorder;
+ runlen += state.melcorder;
- if (this.rgb_state.melcstate < 32) {
- this.rgb_state.melclen = J[++this.rgb_state.melcstate];
- this.rgb_state.melcorder = (1 << this.rgb_state.melclen);
+ if (state.melcstate < 32) {
+ state.melclen = J[++state.melcstate];
+ state.melcorder = (1 << state.melclen);
}
}
if (temp != 8) {
@@ -900,14 +900,14 @@ QuicEncoder.prototype.decode_run = function()
this.decode_eatbits(8);
} while (true);
- if (this.rgb_state.melclen) {
- runlen += this.io_word >>> (32 - this.rgb_state.melclen);
- this.decode_eatbits(this.rgb_state.melclen);
+ if (state.melclen) {
+ runlen += this.io_word >>> (32 - state.melclen);
+ this.decode_eatbits(state.melclen);
}
- if (this.rgb_state.melcstate) {
- this.rgb_state.melclen = J[--this.rgb_state.melcstate];
- this.rgb_state.melcorder = (1 << this.rgb_state.melclen);
+ if (state.melcstate) {
+ state.melclen = J[--state.melcstate];
+ state.melcorder = (1 << state.melclen);
}
return runlen;