correctly parse labQ with extra channels

This commit is contained in:
Angel Sánchez 2019-06-21 14:14:40 +02:00 committed by John Cupitt
parent 415af7a10c
commit 4ba6373357
1 changed files with 6 additions and 2 deletions

View File

@ -756,6 +756,7 @@ rtiff_labpack_line( Rtiff *rtiff, VipsPel *q, VipsPel *p, int n, void *dummy )
float pf[3]; float pf[3];
int x; int x;
int i;
for( x = 0; x < n; x++ ) { for( x = 0; x < n; x++ ) {
pf[0] = p[0] * 100.0f / 255.0f; pf[0] = p[0] * 100.0f / 255.0f;
@ -764,7 +765,10 @@ rtiff_labpack_line( Rtiff *rtiff, VipsPel *q, VipsPel *p, int n, void *dummy )
vips__Lab2LabQ_vec(q, pf, 1); vips__Lab2LabQ_vec(q, pf, 1);
q += 4; for (i = 3; i < samples_per_pixel; i++)
q[i+1] = p[i];
q += samples_per_pixel+1;
p += samples_per_pixel; p += samples_per_pixel;
} }
} }
@ -779,7 +783,7 @@ rtiff_parse_labpack( Rtiff *rtiff, VipsImage *out )
rtiff_check_interpretation( rtiff, PHOTOMETRIC_CIELAB ) ) rtiff_check_interpretation( rtiff, PHOTOMETRIC_CIELAB ) )
return( -1 ); return( -1 );
out->Bands = 4; out->Bands = rtiff->header.samples_per_pixel + 1;
out->BandFmt = VIPS_FORMAT_UCHAR; out->BandFmt = VIPS_FORMAT_UCHAR;
out->Coding = VIPS_CODING_LABQ; out->Coding = VIPS_CODING_LABQ;
out->Type = VIPS_INTERPRETATION_LAB; out->Type = VIPS_INTERPRETATION_LAB;