Skip to content

Commit

Permalink
preparing to publish 0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
brianxautumn committed Feb 27, 2017
1 parent 60551e6 commit e96030b
Show file tree
Hide file tree
Showing 9 changed files with 313 additions and 312 deletions.
243 changes: 121 additions & 122 deletions builds/jsvpx.js

Large diffs are not rendered by default.

248 changes: 124 additions & 124 deletions builds/ogv-decoder-video-vp8.js

Large diffs are not rendered by default.

19 changes: 14 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
{
"name": "jsivf",
"name": "jsvpx",
"version": "0.0.0",
"keywords": [
"webm",
"vp8"
"vp8",
"vp9",
"ogv.js"
],
"description" : "Javascript implementation of libvpx",
"scripts": {
"build": "webpack",
"build-benchmark": "USE_BENCHMARK=true webpack",
"test": "mocha test/test.js --timeout 20000"
"build-benchmark": "USE_BENCHMARK=true webpack",
"test": "mocha test/test.js --timeout 20000"
},
"author": "Brian Parra",
"contributors": [
"Brion Vibber <brion@pobox.com>"
],
"repository": {
"type": "git",
"url": "https://github.com/jscodec/jsvpx.git"
},
"devDependencies": {
"browserify": "^13.0.1",
"browserify-shim": "^3.5.0",
Expand All @@ -28,5 +36,6 @@
"jsivf" : "^0.0.1",
"ogv" : "^1.3.0"
},
"main" : "src/vp8.js"
"main" : "builds/jsvpx.js",
"license": "MIT"
}
12 changes: 1 addition & 11 deletions vp8/common/findnearmv.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,14 @@ var V_PRED = 1;
var H_PRED = 2;
var TM_PRED = 3;
var B_PRED = 4;
var NEARESTMV = 5;
var NEARMV = 6;
var ZEROMV = 7;
var NEWMV = 8;
var SPLITMV = 9;
var MB_MODE_COUNT = 10;


var B_DC_PRED = 0; /* average of above and left pixels */
var B_TM_PRED = 1;
var B_VE_PRED = 2; /* vertical prediction */
var B_HE_PRED = 3; /* horizontal prediction */


var this_mv_1 = new MotionVector();

var this_mv_2 = new MotionVector();


function mv_bias(mb, sign_bias, ref_frame, mv) {

if (sign_bias[mb.mbmi.ref_frame] ^ sign_bias[ref_frame]) {
Expand Down
29 changes: 11 additions & 18 deletions vp8/common/idctllm.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ function vp8_short_idct4x4llm_c(recon, recon_off, predict, predict_off, stride,
coeffs_off = tmp_off;
var recon_32 = recon.data_32;
var r0, r1, r2, r3;
var p0, p1, p2, p3;
var p32;

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

Expand All @@ -185,24 +187,15 @@ function vp8_short_idct4x4llm_c(recon, recon_off, predict, predict_off, stride,
temp1 = coeff_1 + ((coeff_1 * cospi8sqrt2minus1) >> 16);
temp2 = (coeff_3 * sinpi8sqrt2) >> 16;
d1 = temp1 + temp2;

/*
if (predict_off % 4 === 0) {
var test = predict.data_32[predict_off >> 2];
var p0 = test & 0xFF;
var p1 = (test >> 8) & 0xFF;
var p2 = (test >> 16) & 0xFF;
var p3 = (test >> 24) & 0xFF;
}else{
*/
var p0 = predict[predict_off];
var p1 = predict[predict_off + 1];
var p2 = predict[predict_off + 2];
var p3 = predict[predict_off + 3];
//}




p0 = predict[predict_off];
p1 = predict[predict_off + 1];
p2 = predict[predict_off + 2];
p3 = predict[predict_off + 3];



r0 = CLAMP_255(p0 + ((a1 + d1 + 4) >> 3));
r1 = CLAMP_255(p1 + ((b1 + c1 + 4) >> 3));
r2 = CLAMP_255(p2 + ((b1 - c1 + 4) >> 3));
Expand Down
33 changes: 26 additions & 7 deletions vp8/common/loopfilter_filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ var max = Math.max;
function saturate_int8(x) {

return min(max(x, -128), 127);

}

function saturate_uint8(x) {
return min(max(x, 0), 255);

}

//possible vp8_simple_filter
function vp8_filter(pixels, pixels_off, stride, use_outer_taps) {
var p1 = pixels[pixels_off - 2 * stride];
var stride2 = 2 * stride;
var p1 = pixels[pixels_off - stride2];
var p0 = pixels[pixels_off - stride];
var q0 = pixels[pixels_off];
var q1 = pixels[pixels_off + stride];
Expand All @@ -31,8 +34,24 @@ function vp8_filter(pixels, pixels_off, stride, use_outer_taps) {

a = saturate_int8(a);

f1 = ((a + 4 > 127) ? 127 : a + 4) >> 3;
f2 = ((a + 3 > 127) ? 127 : a + 3) >> 3;



//f1 = ((a + 4 > 127) ? 127 : a + 4) >> 3;
if((a + 4) > 127){
f1 = 15;
}else{
f1 = (a + 4) >> 3;
}


//f2 = ((a + 3 > 127) ? 127 : a + 3) >> 3;
if((a + 4) > 127){
f2 = 15;
}else{
f2 = (a + 3) >> 3;
}


p0 = saturate_uint8(p0 + f2);
q0 = saturate_uint8(q0 - f1);
Expand All @@ -47,7 +66,7 @@ function vp8_filter(pixels, pixels_off, stride, use_outer_taps) {
q1 = saturate_uint8(q1 - a);
}

pixels[pixels_off - 2 * stride] = p1;
pixels[pixels_off - stride2] = p1;
pixels[pixels_off - stride] = p0;
pixels[pixels_off] = q0;
pixels[pixels_off + stride] = q1;
Expand Down Expand Up @@ -149,6 +168,7 @@ function filter_mb_v_edge(src,


function normal_threshold(pixels, pixels_off, stride, edge_limit, interior_limit) {

var p3 = pixels[pixels_off - 4 * stride];
var p2 = pixels[pixels_off - 3 * stride];
var p1 = pixels[pixels_off - 2 * stride];
Expand Down Expand Up @@ -241,9 +261,8 @@ function filter_subblock_v_edge(src, src_off, stride, edge_limit, interior_limit
for (i = 0; i < limit; i++) {

if (normal_threshold(src, src_off, 1, edge_limit, interior_limit))
// console.warn(i + ":" + edge_limit + ":" + interior_limit + ":" + hev_threshold);
vp8_filter(src, src_off, 1,
high_edge_variance(src, src_off, 1, hev_threshold));

vp8_filter(src, src_off, 1, high_edge_variance(src, src_off, 1, hev_threshold));


src_off += stride;
Expand Down
9 changes: 0 additions & 9 deletions vp8/common/mv.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ Object.defineProperty(MotionVector.prototype, 'x', {
}
});

this.x = {
get: function () {
return this.internalStruct[0];
},
set: function (x) {
this.internalStruct[0] = x;
}
};

Object.defineProperty(MotionVector.prototype, 'y', {
get: function () {
return this.internalStruct[1];
Expand Down
19 changes: 9 additions & 10 deletions vp8/common/reconinter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var filter = require('../common/filter.js');
var filter_block2d = filter.filter_block2d;

var SPLITMV = 9;
var MB_MODE_COUNT = 10;

var idctllm = require('../common/idctllm.js');
var vp8_short_inv_walsh4x4_c = idctllm.vp8_short_inv_walsh4x4_c;
Expand Down Expand Up @@ -76,7 +75,7 @@ function predict_inter_emulated_edge(ctx,
if (mode !== SPLITMV)
ymv = mbi.mbmi.mv;
else
ymv = mvs[ b];
ymv = mvs[b];

recon_1_edge_block(output, output_off, emul_block, emul_block_off, reference, reference_off, img.stride,
ymv, ctx.subpixel_filters,
Expand Down Expand Up @@ -147,7 +146,8 @@ function build_4x4uvmvs(mbi, full_pixel) {

var b = (i << 3) + (j << 1);
var chroma_ptr = (i << 1) + j;

var chroma_mv_cache = chroma_mv[chroma_ptr];

var temp = 0;


Expand All @@ -162,7 +162,7 @@ function build_4x4uvmvs(mbi, full_pixel) {
else
temp += 4;

chroma_mv[chroma_ptr].x = (temp / 8 ) | 0;
chroma_mv_cache.x = (temp / 8 ) | 0;

temp = mvs[b].y +
mvs[b + 1].y +
Expand All @@ -174,10 +174,10 @@ function build_4x4uvmvs(mbi, full_pixel) {
else
temp += 4;

chroma_mv[chroma_ptr].y = (temp / 8) | 0;
chroma_mv_cache.y = (temp / 8) | 0;

if (full_pixel === 1) {
chroma_mv[chroma_ptr].as_int &= 0xFFF8FFF8;
chroma_mv_cache.as_int &= 0xFFF8FFF8;

}

Expand All @@ -192,8 +192,7 @@ function build_4x4uvmvs(mbi, full_pixel) {
function build_mc_border(dst, dst_off, src, src_off, stride, x, y, b_w, b_h, w, h) {
var ref_row = 0;
var ref_row_off = 0;



/* Get a pointer to the start of the real data for this row */
ref_row = src;
ref_row_off = src_off - x - y * stride;
Expand Down Expand Up @@ -411,7 +410,7 @@ function vp8_build_inter16x16_predictors_mb(mbi, full_pixel) {

uvmv.as_int = mbmi_cache.mv.as_int;

if (mbi.mbmi.need_mc_border) {
if (mbi.mbmi.need_mc_border === 1) {
var x = uvmv.x;
var y = uvmv.y;
uvmv.x = (x + 1 + ((x >> 31) << 1));
Expand Down Expand Up @@ -465,7 +464,7 @@ function vp8_build_inter_predictors_mb(ctx,
}


if (mbi.mbmi.need_mc_border)
if (mbi.mbmi.need_mc_border === 1)
predict_inter_emulated_edge(ctx, img, coeffs, coeffs_off, mbi, mb_col, mb_row);

else
Expand Down
13 changes: 7 additions & 6 deletions vp8/common/vp8_loopfilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ function vp8_loop_filter_row_simple(ctx, row) {
var edge_limit_cache = new Uint8Array([0]), interior_limit_cache = new Uint8Array([0]), hev_threshold_cache = new Uint8Array([0]);

function vp8_loop_filter_row_normal(ctx, row, start_col, num_cols) {

var y = 0, u = 0, v = 0;
var y_off = 0, u_off = 0, v_off = 0;
var stride = 0, uv_stride = 0;
Expand All @@ -121,14 +122,14 @@ function vp8_loop_filter_row_normal(ctx, row, start_col, num_cols) {
y_off = currentImg.planes_off[PLANE_Y];
u_off = currentImg.planes_off[PLANE_U];
v_off = currentImg.planes_off[PLANE_V];
y_off += (stride * row + start_col) * 16;
u_off += (uv_stride * row + start_col) * 8;
v_off += (uv_stride * row + start_col) * 8;
y_off += (stride * row ) * 16;
u_off += (uv_stride * row) * 8;
v_off += (uv_stride * row ) * 8;
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];

var total_cols = start_col + num_cols;
for (col = start_col; col < total_cols; col++)

for (col = 0; col < num_cols; col++)
{
//var edge_limit = [0], interior_limit = [0], hev_threshold = [0];
var edge_limit = edge_limit_cache, interior_limit = interior_limit_cache, hev_threshold = hev_threshold_cache;
Expand Down

0 comments on commit e96030b

Please sign in to comment.