Skip to content

Commit

Permalink
Better memory handling, bumping version
Browse files Browse the repository at this point in the history
  • Loading branch information
brianxautumn committed Mar 6, 2017
1 parent dcadb64 commit 99e1055
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 206 deletions.
176 changes: 88 additions & 88 deletions builds/jsvpx.js

Large diffs are not rendered by default.

210 changes: 105 additions & 105 deletions builds/ogv-decoder-video-vp8.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsvpx",
"version": "0.0.0",
"version": "0.0.1",
"keywords": [
"webm",
"vp8",
Expand Down
5 changes: 3 additions & 2 deletions vp8/common/reconinter.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ function predict_inter_emulated_edge(ctx,

output = img.y;
output_off = img.y_off;
reference_offset = ctx.ref_frame_offsets[ref_frame];
reference = ctx.ref_frame_offsets_[ref_frame];

reference_off = output_off + reference_offset;
var mode = mbi.mbmi.y_mode;
var mvs = mbi.bmi.mvs;

reference_offset = ctx.ref_frame_offsets[ref_frame];
reference = ctx.ref_frame_offsets_[ref_frame];



// Luma
for (b = 0; b < 16; b++) {
Expand Down
23 changes: 13 additions & 10 deletions vp8/decoder/decodeframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ function decode_mb_rows(ctx) {


for (var row = 0, partition = 0; row < mb_rows; row++) {
var start_col = 0;




var mbi;
Expand All @@ -221,7 +218,7 @@ function decode_mb_rows(ctx) {
img.u_off += (img.uv_stride * row ) << 3;
img.v_off += (img.uv_stride * row ) << 3;
mbi = ctx.mb_info_rows; //[1 + row];
mbi_off = (ctx.mb_info_rows_off[1 + row] + start_col);
mbi_off = (ctx.mb_info_rows_off[1 + row]);
coeffs = ctx.tokens[row & (ctx.token_hdr.partitions - 1)].coeffs;


Expand Down Expand Up @@ -253,7 +250,7 @@ function decode_mb_rows(ctx) {


//probably line 485
for (col = start_col; col < mb_cols; col++) {
for (col = 0; col < mb_cols; col++) {
//if (col > 0) {


Expand Down Expand Up @@ -563,13 +560,15 @@ function init_frame(pbi) {
var pc = pbi.common;
var xd = pbi.segment_hdr;

var to = pc.entropy_hdr.mv_probs;

if (pc.is_keyframe === true) {

for (var i = 0; i < MV_PROB_CNT; i++)
pc.entropy_hdr.mv_probs[0][i] = vp8_default_mv_context[0][i];
to[0][i] = vp8_default_mv_context[0][i];

for (var i = 0; i < MV_PROB_CNT; i++)
pc.entropy_hdr.mv_probs[1][i] = vp8_default_mv_context[1][i];
to[1][i] = vp8_default_mv_context[1][i];

vp8_init_mbmode_probs(pc);
vp8_default_coef_probs(pc);
Expand Down Expand Up @@ -869,11 +868,13 @@ function vp8_decode_frame(data, decoder) {
var this_frame_mbmi_off = 0;

if (pc.frame_size_updated === 1) {


var w = ((decoder.mb_cols << 4) + 32) | 0;
var h = ((decoder.mb_rows << 4) + 32) | 0;

for (i = 0; i < NUM_REF_FRAMES; i++) {

var w = ((decoder.mb_cols << 4) + 32) | 0;
var h = ((decoder.mb_rows << 4) + 32) | 0;


vpx_img_free(decoder.frame_strg[i].img);
decoder.frame_strg[i].ref_cnt = 0;
Expand Down Expand Up @@ -912,9 +913,11 @@ function vp8_decode_frame(data, decoder) {
if (ref) {
decoder.ref_frame_offsets[i] = ref.img.img_data_off - this_frame_mbmi_off;
decoder.ref_frame_offsets_[i] = ref.img.img_data;

} else {
decoder.ref_frame_offsets[i] = 0;
decoder.ref_frame_offsets_[i] = this_frame_mbmi;

}
}

Expand Down
1 change: 1 addition & 0 deletions vp8/decoder/onyxd_int.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class VP8D_COMP {


this.ref_frame_offsets = new Uint32Array([0, 0, 0, 0]);
this.ref_frame = null;
this.ref_frame_offsets_ = [0, 0, 0, 0];
this.subpixel_filters = null;

Expand Down

0 comments on commit 99e1055

Please sign in to comment.