Comments (1)
Here is an idea for a patch.
diff --git a/lib/libv4lconvert/jpeg.c b/lib/libv4lconvert/jpeg.c
index 15f8dec7..4f4af582 100644
--- a/lib/libv4lconvert/jpeg.c
+++ b/lib/libv4lconvert/jpeg.c
@@ -238,14 +238,30 @@ static int decode_libjpeg_h_samp2(struct v4lconvert_data *data,
struct jpeg_decompress_struct *cinfo = &data->cinfo;
int y;
unsigned int width = cinfo->image_width;
+ unsigned char *drain_buf;
JSAMPROW y_rows[16], u_rows[8], v_rows[8];
JSAMPARRAY rows[3] = { y_rows, u_rows, v_rows };
+ drain_buf = v4lconvert_alloc_buffer(width,
+ &data->convert_pixfmt_buf,
+ &data->convert_pixfmt_buf_size);
+ if (!drain_buf)
+ return v4lconvert_oom_error(data);
+
while (cinfo->output_scanline < cinfo->image_height) {
- for (y = 0; y < 8 * v_samp; y++) {
+ int last_y = cinfo->image_height - cinfo->output_scanline;
+ int last_uv;
+
+ last_y = last_y < 8 * v_samp ? last_y : 8 * v_samp;
+ last_uv = last_y / v_samp;
+
+ for (y = 0; y < last_y; y++) {
y_rows[y] = ydest;
ydest += width;
}
+ for (; y < 8 * v_samp; y++)
+ y_rows[y] = drain_buf;
+
/*
* For v_samp == 1 were going to get 1 set of uv values per
* line, but we need only 1 set per 2 lines since our output
@@ -253,7 +269,7 @@ static int decode_libjpeg_h_samp2(struct v4lconvert_data *data,
* effectively using the second set for each output line.
*/
if (v_samp == 1) {
- for (y = 0; y < 8; y++) {
+ for (y = 0; y < last_uv; y++) {
u_rows[y] = udest;
v_rows[y] = vdest;
y++;
@@ -262,13 +278,18 @@ static int decode_libjpeg_h_samp2(struct v4lconvert_data *data,
udest += width / 2;
vdest += width / 2;
}
+ for (; y < 8; y++)
+ u_rows[y] = v_rows[y] = drain_buf;
+
} else { /* v_samp == 2 */
- for (y = 0; y < 8; y++) {
+ for (y = 0; y < last_uv; y++) {
u_rows[y] = udest;
v_rows[y] = vdest;
udest += width / 2;
vdest += width / 2;
}
+ for (; y < 8; y++)
+ u_rows[y] = v_rows[y] = drain_buf;
}
y = jpeg_read_raw_data(cinfo, rows, 8 * v_samp);
@@ -390,12 +411,14 @@ int v4lconvert_decode_jpeg_libjpeg(struct v4lconvert_data *data,
}
/* We don't want any padding as that may overflow our dest */
+#if 0
if (width % (8 * h_samp) || height % (8 * v_samp)) {
V4LCONVERT_ERR(
"resolution is not a multiple of dctsize");
errno = EIO;
return -1;
}
+#endif
if (dest_pix_fmt == V4L2_PIX_FMT_YVU420) {
vdest = dest + width * height;
from freshplayerplugin.
Related Issues (20)
- drm test works with intel but not Nvidia HOT 4
- 32 bit build error HOT 2
- [firefox] "[fresh] [error] n2p_call_ptac, NPN_Invoke failed (or there were no npp)" HOT 6
- Build failure HOT 5
- Missing include for sys/ioctl.h in src/ppb_video_capture.c HOT 1
- (question): use with other browsers still limited to the NPAPI? HOT 9
- using Chromebook flash for desktop Chrome HOT 2
- Fullscreen showing very small window HOT 5
- Chromebook's flash used by firefox works on test but fails in real life HOT 9
- freshwrapper crashing with Firefox 61 and ChromeOS's Flash HOT 2
- Is v0.3.10 production-ready? HOT 1
- asoundlib.h: No such file or directory HOT 4
- Wayland support? HOT 1
- Trouble on XWayland
- FreshPlugin as browser extension HOT 1
- libfreshplayer does not show up in Firefox 69.0.1 64bit HOT 9
- advice on fixing https://gitlab.com/Mis012/flashplayer-standalone to make it work with freshplayer HOT 9
- Does freshplayerplugin can be used a plugin on chromium[version:69] HOT 19
- Error when using make HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freshplayerplugin.