webp-ffi 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/ext/webp_ffi/util.c +5 -15
- data/lib/webp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dc135cb052630588802ca113f8d11a18ccd0dfe
|
4
|
+
data.tar.gz: 685b69ef56c9d2928ab5a6c2f1631f5675bb5796
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b38a77daf24a59aebe807b2444f2a8c601392f78d1d4bdac3363887268ecd2f647577c66bad6847b9dd4ebc147d53c81b5724da042107b4ec1712a427a39edc
|
7
|
+
data.tar.gz: 56a5f00d3cc2b4719060d5e6b03684754d34451cab57a05ce2f476153631f386fd61ce39877f722e3e1ddf68eaf938eec8102672e307dee823ecd1bbbb9a6532
|
data/CHANGELOG.md
CHANGED
data/ext/webp_ffi/util.c
CHANGED
@@ -63,10 +63,9 @@ static int UtilReadJPEG(FILE* in_file, WebPPicture* const pic) {
|
|
63
63
|
int ok = 0;
|
64
64
|
int stride, width, height;
|
65
65
|
uint8_t* rgb = NULL;
|
66
|
-
uint8_t* row_ptr = NULL;
|
67
66
|
struct jpeg_decompress_struct dinfo;
|
68
67
|
struct my_error_mgr jerr;
|
69
|
-
|
68
|
+
JSAMPROW buffer[1];
|
70
69
|
|
71
70
|
dinfo.err = jpeg_std_error(&jerr.pub);
|
72
71
|
jerr.pub.error_exit = my_error_exit;
|
@@ -82,7 +81,6 @@ static int UtilReadJPEG(FILE* in_file, WebPPicture* const pic) {
|
|
82
81
|
jpeg_read_header(&dinfo, TRUE);
|
83
82
|
|
84
83
|
dinfo.out_color_space = JCS_RGB;
|
85
|
-
dinfo.dct_method = JDCT_IFAST;
|
86
84
|
dinfo.do_fancy_upsampling = TRUE;
|
87
85
|
|
88
86
|
jpeg_start_decompress(&dinfo);
|
@@ -99,20 +97,13 @@ static int UtilReadJPEG(FILE* in_file, WebPPicture* const pic) {
|
|
99
97
|
if (rgb == NULL) {
|
100
98
|
goto End;
|
101
99
|
}
|
102
|
-
|
103
|
-
|
104
|
-
buffer = (*dinfo.mem->alloc_sarray) ((j_common_ptr) &dinfo,
|
105
|
-
JPOOL_IMAGE, stride, 1);
|
106
|
-
if (buffer == NULL) {
|
107
|
-
goto End;
|
108
|
-
}
|
100
|
+
buffer[0] = (JSAMPLE*)rgb;
|
109
101
|
|
110
102
|
while (dinfo.output_scanline < dinfo.output_height) {
|
111
103
|
if (jpeg_read_scanlines(&dinfo, buffer, 1) != 1) {
|
112
104
|
goto End;
|
113
105
|
}
|
114
|
-
|
115
|
-
row_ptr += stride;
|
106
|
+
buffer[0] += stride;
|
116
107
|
}
|
117
108
|
|
118
109
|
jpeg_finish_decompress(&dinfo);
|
@@ -122,11 +113,10 @@ static int UtilReadJPEG(FILE* in_file, WebPPicture* const pic) {
|
|
122
113
|
pic->width = width;
|
123
114
|
pic->height = height;
|
124
115
|
ok = WebPPictureImportRGB(pic, rgb, stride);
|
116
|
+
if (!ok) goto Error;
|
125
117
|
|
126
118
|
End:
|
127
|
-
|
128
|
-
free(rgb);
|
129
|
-
}
|
119
|
+
free(rgb);
|
130
120
|
return ok;
|
131
121
|
}
|
132
122
|
|
data/lib/webp/version.rb
CHANGED