For now, punt on trying to support fancy upsampling in tjDecodeYUV(). Fancy upsampling requires context rows and other refinements, which are difficult to implement correctly with the algorithm we're using. Longer-term, supporting fancy upsampling would probably require using the main buffer that libjpeg allocates.

This commit is contained in:
DRC
2014-03-10 20:14:53 +00:00
parent adb33bb1a4
commit 1cdf41108b

View File

@@ -1293,7 +1293,7 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf,
int i, retval=0; JSAMPROW *row_pointer=NULL; int i, retval=0; JSAMPROW *row_pointer=NULL;
JSAMPLE *_tmpbuf[MAX_COMPONENTS]; JSAMPLE *_tmpbuf[MAX_COMPONENTS];
JSAMPROW *tmpbuf[MAX_COMPONENTS], *inbuf[MAX_COMPONENTS]; JSAMPROW *tmpbuf[MAX_COMPONENTS], *inbuf[MAX_COMPONENTS];
int row, pw, ph, cw[MAX_COMPONENTS], ch[MAX_COMPONENTS], useMerged=0; int row, pw, ph, cw[MAX_COMPONENTS], ch[MAX_COMPONENTS];
JSAMPLE *ptr=srcBuf; JSAMPLE *ptr=srcBuf;
unsigned long yuvsize=0; unsigned long yuvsize=0;
jpeg_component_info *compptr; jpeg_component_info *compptr;
@@ -1364,14 +1364,8 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf,
{ {
retval=-1; goto bailout; retval=-1; goto bailout;
} }
if(flags&TJFLAG_FASTUPSAMPLE) dinfo->do_fancy_upsampling=FALSE;
{
dinfo->do_fancy_upsampling=FALSE;
if((subsamp==TJSAMP_422 || subsamp==TJSAMP_420) && pixelFormat!=TJPF_GRAY)
useMerged=1;
}
jinit_master_decompress(dinfo); jinit_master_decompress(dinfo);
if(!useMerged) (*dinfo->cconvert->start_pass)(dinfo);
(*dinfo->upsample->start_pass)(dinfo); (*dinfo->upsample->start_pass)(dinfo);
pw=PAD(width, dinfo->max_h_samp_factor); pw=PAD(width, dinfo->max_h_samp_factor);