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.

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@476 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2011-03-01 08:23:53 +00:00
3 changed files with 11 additions and 4 deletions

View File

@@ -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
=====

View File

@@ -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; \
}}

View File

@@ -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);