Don't call jpeg_finish_compress() with YUV output, because it tries to insert an EOI marker right in the middle of our image data.
This commit is contained in:
@@ -6,6 +6,13 @@
|
||||
[2] TurboJPEG/OSS can now scale down images during decompression.
|
||||
|
||||
|
||||
1.1.1
|
||||
=====
|
||||
|
||||
[1] Fixed a 1-pixel error in row 0, column 21 of the luminance plane generated
|
||||
by tjEncodeYUV().
|
||||
|
||||
|
||||
1.1.0
|
||||
=====
|
||||
|
||||
|
||||
2
jpegut.c
2
jpegut.c
@@ -222,7 +222,7 @@ int checkbuf(unsigned char *buf, int w, int h, int ps, int subsamp,
|
||||
}}
|
||||
|
||||
#define checkval255(v) { \
|
||||
if(v<254 && !(v==217 && i==0 && j==21)) { \
|
||||
if(v<254) { \
|
||||
printf("\nComp. %s at %d,%d should be 255, not %d\n", #v, i, j, v); \
|
||||
retval=0; goto bailout; \
|
||||
}}
|
||||
|
||||
@@ -310,6 +310,7 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
|
||||
}
|
||||
*size=yuvsize;
|
||||
cinfo->next_scanline+=height;
|
||||
jpeg_abort_compress(&j->cinfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -325,11 +326,10 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
|
||||
jpeg_write_scanlines(&j->cinfo, &row_pointer[j->cinfo.next_scanline],
|
||||
j->cinfo.image_height-j->cinfo.next_scanline);
|
||||
}
|
||||
}
|
||||
jpeg_finish_compress(&j->cinfo);
|
||||
if(!(flags&TJ_YUV))
|
||||
jpeg_finish_compress(&j->cinfo);
|
||||
*size=TJBUFSIZE(j->cinfo.image_width, j->cinfo.image_height)
|
||||
-(unsigned long)(j->jdms.free_in_buffer);
|
||||
}
|
||||
|
||||
bailout:
|
||||
if(j->cinfo.global_state>CSTATE_START) jpeg_abort_compress(&j->cinfo);
|
||||
|
||||
Reference in New Issue
Block a user