Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for YUV422 #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 10 additions & 12 deletions lib/libde265.js
Original file line number Diff line number Diff line change
Expand Up @@ -10916,7 +10916,7 @@ var WorkerConverter = function() {
}
var blob = new Blob([
"(function() {\n",
_do_convert_yuv420.toString() + ";\n",
_do_convert_yuv.toString() + ";\n",
_do_convert_yuv2rgb.toString() + ";\n",
worker_func_data + ";\n",
worker_func_name + "();\n",
Expand Down Expand Up @@ -11114,7 +11114,7 @@ Decoder.prototype.decode = function(callback) {
return;
};

function _do_convert_yuv420(y, u, v, w, h, stridey, strideu, stridev, bppy, bppu, bppv, dest) {
function _do_convert_yuv(y, u, v, w, h, stridey, strideu, stridev, bppy, bppu, bppv, dest, logRowsUVStride) {
var yval;
var uval;
var vval;
Expand Down Expand Up @@ -11150,8 +11150,8 @@ function _do_convert_yuv420(y, u, v, w, h, stridey, strideu, stridev, bppy, bppu
xpos = 0;
ypos++;
yoffset += stridey;
uoffset = ((ypos >> 1) * strideu);
voffset = ((ypos >> 1) * stridev);
uoffset = ((ypos >> logRowsUVStride) * strideu);
voffset = ((ypos >> logRowsUVStride) * stridev);
}
}
}
Expand All @@ -11162,22 +11162,20 @@ function _do_convert_yuv2rgb(chroma, y, u, v, w, h, stridey, strideu, stridev, b
}
// NOTE: we can't use libde265 constants here as the function can also be
// run inside the Worker where "libde265" is not available.
if (bppy !== 8 || bppu !== 8 || bppv !== 8) {
// TODO(fancycode): implement me
console.log("Chroma format not implemented yet", chroma, bppy, bppu, bppv);
}
switch (chroma) {
case 0: /* libde265.de265_chroma_mono */
// TODO(fancycode): implement me
console.log("Chroma format not implemented yet", chroma, bppy, bppu, bppv);
break;
case 1: /* libde265.de265_chroma_420 */
if (bppy !== 8 || bppu !== 8 || bppv !== 8) {
// TODO(fancycode): implement me
console.log("Chroma format not implemented yet", chroma, bppy, bppu, bppv);
} else {
_do_convert_yuv420(y, u, v, w, h, stridey, strideu, stridev, bppy, bppu, bppv, dest);
}
_do_convert_yuv(y, u, v, w, h, stridey, strideu, stridev, bppy, bppu, bppv, dest, 1);
break;
case 2: /* libde265.de265_chroma_422 */
// TODO(fancycode): implement me
console.log("Chroma format not implemented yet", chroma, bppy, bppu, bppv);
_do_convert_yuv(y, u, v, w, h, stridey, strideu, stridev, bppy, bppu, bppv, dest, 0);
break;
case 3: /* libde265.de265_chroma_444 */
// TODO(fancycode): implement me
Expand Down