webp-ffi 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2369fa3ab99b3d494db9eeeb7f19c340c940d91d
4
- data.tar.gz: 58ebaf382e3b9159ccb01f9d780b76a9be55d11f
3
+ metadata.gz: 5dc135cb052630588802ca113f8d11a18ccd0dfe
4
+ data.tar.gz: 685b69ef56c9d2928ab5a6c2f1631f5675bb5796
5
5
  SHA512:
6
- metadata.gz: feb10c1edaaab6101c969dc8ea38324dae4e9a5268d71f994abb8dff878b1ce2c54553a19100bbf982d5b59ad99c6f692c974b3a5345fa03fae369dd067d4794
7
- data.tar.gz: 002dda47a905f3f2e2dfd85b310eacd7771df366eeb663c0754ba10a9b54f3fb351768b46b8195799ea1b07da670c2a1a45a343030774bb80b80c9727410c5cc
6
+ metadata.gz: 4b38a77daf24a59aebe807b2444f2a8c601392f78d1d4bdac3363887268ecd2f647577c66bad6847b9dd4ebc147d53c81b5724da042107b4ec1712a427a39edc
7
+ data.tar.gz: 56a5f00d3cc2b4719060d5e6b03684754d34451cab57a05ce2f476153631f386fd61ce39877f722e3e1ddf68eaf938eec8102672e307dee823ecd1bbbb9a6532
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.2.3
2
+
3
+ * Fix jpg read in C code
4
+
1
5
  ## v0.2.2
2
6
 
3
7
  * Fix png lossless
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
- JSAMPARRAY buffer;
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
- row_ptr = rgb;
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
- memcpy(row_ptr, buffer[0], stride);
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
- if (rgb) {
128
- free(rgb);
129
- }
119
+ free(rgb);
130
120
  return ok;
131
121
  }
132
122
 
data/lib/webp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module WebP
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webp-ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Vasyliev