libjpeg-ruby 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/jpeg/jpeg.c +18 -21
- data/lib/jpeg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3523da7ee57f41d57b81fe97558564e0b0459c5977321ba88a298a450cd9273a
|
4
|
+
data.tar.gz: 103f379375f273f0f9a77109cc3dff8018779ce94837d2182e1e0ce50bb78213
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd38c818582812ce2ef404ade310846a5af944e2b05c2b16df4df66bf62dd3404c9c68c6508e65e8a603041ab6f0d21484d911680e967f7e11aa9ad94a7d2782
|
7
|
+
data.tar.gz: a05940b338d1660f90345c7eebdeea897629ac37c33949720cde9d4c4d5794eb73dcb0f1be568d078110185ffe223425e4f5cb61da10f3075dd63a6c1a1fe185
|
data/ext/jpeg/jpeg.c
CHANGED
@@ -33,7 +33,6 @@
|
|
33
33
|
#define F_APPLY_ORIENTATION 0x00000008
|
34
34
|
#define F_DITHER 0x00000010
|
35
35
|
#define F_CREAT 0x00010000
|
36
|
-
#define F_START 0x00020000
|
37
36
|
|
38
37
|
#define SET_FLAG(ptr, msk) ((ptr)->flags |= (msk))
|
39
38
|
#define CLR_FLAG(ptr, msk) ((ptr)->flags &= ~(msk))
|
@@ -69,8 +68,8 @@
|
|
69
68
|
#define IS_COLORMAPPED(ci) (((ci)->actual_number_of_colors > 0) &&\
|
70
69
|
((ci)->colormap != NULL) && \
|
71
70
|
((ci)->output_components == 1) && \
|
72
|
-
|
73
|
-
|
71
|
+
(((ci)->out_color_components == 1) || \
|
72
|
+
((ci)->out_color_components == 3)))
|
74
73
|
|
75
74
|
#define ALLOC_ARRAY() \
|
76
75
|
((JSAMPARRAY)malloc(sizeof(JSAMPROW) * UNIT_LINES))
|
@@ -1217,6 +1216,7 @@ do_encode(VALUE _ptr)
|
|
1217
1216
|
/*
|
1218
1217
|
* when error occurred
|
1219
1218
|
*/
|
1219
|
+
jpeg_abort_compress(&ptr->cinfo);
|
1220
1220
|
rb_raise(encerr_klass, "%s", ptr->err_mgr.msg);
|
1221
1221
|
|
1222
1222
|
} else {
|
@@ -1224,7 +1224,6 @@ do_encode(VALUE _ptr)
|
|
1224
1224
|
* normal path
|
1225
1225
|
*/
|
1226
1226
|
jpeg_start_compress(&ptr->cinfo, TRUE);
|
1227
|
-
SET_FLAG(ptr, F_START);
|
1228
1227
|
|
1229
1228
|
if (ptr->orientation != 0) {
|
1230
1229
|
put_exif_tags(ptr);
|
@@ -1240,6 +1239,8 @@ do_encode(VALUE _ptr)
|
|
1240
1239
|
data += (ptr->stride * nrow);
|
1241
1240
|
}
|
1242
1241
|
|
1242
|
+
jpeg_finish_compress(&ptr->cinfo);
|
1243
|
+
|
1243
1244
|
/*
|
1244
1245
|
* build return data
|
1245
1246
|
*/
|
@@ -1310,11 +1311,6 @@ rb_encoder_encode(VALUE self, VALUE data)
|
|
1310
1311
|
/*
|
1311
1312
|
* post process
|
1312
1313
|
*/
|
1313
|
-
if (TEST_FLAG(ptr, F_START)) {
|
1314
|
-
jpeg_finish_compress(&ptr->cinfo);
|
1315
|
-
CLR_FLAG(ptr, F_START);
|
1316
|
-
}
|
1317
|
-
|
1318
1314
|
CLR_DATA(ptr);
|
1319
1315
|
|
1320
1316
|
if (ptr->buf.mem != NULL) {
|
@@ -3548,11 +3544,12 @@ do_decode(VALUE _ptr)
|
|
3548
3544
|
/*
|
3549
3545
|
* when error occurred
|
3550
3546
|
*/
|
3547
|
+
jpeg_abort_decompress(&ptr->cinfo);
|
3551
3548
|
rb_raise(decerr_klass, "%s", ptr->err_mgr.msg);
|
3552
3549
|
|
3553
3550
|
} else {
|
3554
3551
|
/*
|
3555
|
-
*
|
3552
|
+
* initialize
|
3556
3553
|
*/
|
3557
3554
|
jpeg_mem_src(cinfo, data, size);
|
3558
3555
|
|
@@ -3563,6 +3560,9 @@ do_decode(VALUE _ptr)
|
|
3563
3560
|
jpeg_read_header(cinfo, TRUE);
|
3564
3561
|
jpeg_calc_output_dimensions(cinfo);
|
3565
3562
|
|
3563
|
+
/*
|
3564
|
+
* configuration
|
3565
|
+
*/
|
3566
3566
|
cinfo->raw_data_out = FALSE;
|
3567
3567
|
cinfo->dct_method = ptr->dct_method;
|
3568
3568
|
|
@@ -3581,8 +3581,10 @@ do_decode(VALUE _ptr)
|
|
3581
3581
|
cinfo->enable_external_quant = ptr->enable_external_quant;
|
3582
3582
|
cinfo->enable_2pass_quant = ptr->enable_2pass_quant;
|
3583
3583
|
|
3584
|
+
/*
|
3585
|
+
* decode process
|
3586
|
+
*/
|
3584
3587
|
jpeg_start_decompress(cinfo);
|
3585
|
-
SET_FLAG(ptr, F_START);
|
3586
3588
|
|
3587
3589
|
stride = cinfo->output_components * cinfo->output_width;
|
3588
3590
|
raw_sz = stride * cinfo->output_height;
|
@@ -3597,6 +3599,11 @@ do_decode(VALUE _ptr)
|
|
3597
3599
|
jpeg_read_scanlines(cinfo, array, UNIT_LINES);
|
3598
3600
|
}
|
3599
3601
|
|
3602
|
+
jpeg_finish_decompress(&ptr->cinfo);
|
3603
|
+
|
3604
|
+
/*
|
3605
|
+
* build return data
|
3606
|
+
*/
|
3600
3607
|
if (TEST_FLAG(ptr, F_EXPAND_COLORMAP) && IS_COLORMAPPED(cinfo)) {
|
3601
3608
|
ret = expand_colormap(cinfo, raw);
|
3602
3609
|
} else {
|
@@ -3658,16 +3665,6 @@ rb_decoder_decode(VALUE self, VALUE data)
|
|
3658
3665
|
/*
|
3659
3666
|
* post process
|
3660
3667
|
*/
|
3661
|
-
if (TEST_FLAG(ptr, F_START)) {
|
3662
|
-
if (state == 0) {
|
3663
|
-
jpeg_finish_decompress(&ptr->cinfo);
|
3664
|
-
} else {
|
3665
|
-
jpeg_abort_decompress(&ptr->cinfo);
|
3666
|
-
}
|
3667
|
-
|
3668
|
-
CLR_FLAG(ptr, F_START);
|
3669
|
-
}
|
3670
|
-
|
3671
3668
|
CLR_DATA(ptr);
|
3672
3669
|
|
3673
3670
|
if (state != 0) rb_jump_tag(state);
|
data/lib/jpeg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libjpeg-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Kuwagata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|