您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ tjGetErrorStr函数代码示例

51自学网 2021-06-03 08:52:15
  C++
这篇教程C++ tjGetErrorStr函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中tjGetErrorStr函数的典型用法代码示例。如果您正苦于以下问题:C++ tjGetErrorStr函数的具体用法?C++ tjGetErrorStr怎么用?C++ tjGetErrorStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了tjGetErrorStr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: tjInitDecompress

void BEJPEG::read_header ( void ){    int image_width = 0;    int image_height = 0;    tjhandle jpeg_decompressor = tjInitDecompress();    if ( NULL != jpeg_decompressor ) {        if ( data.size() > 0) {            int error = tjDecompressHeader3 ( jpeg_decompressor, &data[0], data.size(), &image_width, &image_height, &chrominance_subsampling, &pixel_format );            tjDestroy(jpeg_decompressor); // error =            if ( 0 == error ) {                adjust_dimensions ( image_width, image_height );            } else {                throw BEPlugin_Exception ( kJPEGReadHeaderError, tjGetErrorStr() );            }        } else {            throw BEPlugin_Exception ( kErrorParameterMissing );        }    } else {        throw BEPlugin_Exception ( kJPEGInitDecompressorError, tjGetErrorStr() );    }}
开发者ID:GoyaPtyLtd,项目名称:BaseElements-Plugin,代码行数:29,


示例2: read_header

void BEJPEG::decompress ( void ){    read_header();    tjhandle jpeg_decompressor = tjInitDecompress();    if ( NULL != jpeg_decompressor ) {        std::vector<unsigned char> decompressed_image ( width * height * tjPixelSize[pixel_format] );        if ( data.size() > 0) {            int error = tjDecompress2 ( jpeg_decompressor, &data[0], data.size(), &decompressed_image[0], width, 0, height, pixel_format, 0 );            tjDestroy ( jpeg_decompressor ); // error =            if ( 0 == error ) {                data = decompressed_image;            } else {                throw BEPlugin_Exception ( kJPEGDecompressionError, tjGetErrorStr() );            }        } else {            throw BEPlugin_Exception ( kErrorParameterMissing );        }    } else {        throw BEPlugin_Exception ( kJPEGInitDecompressorError, tjGetErrorStr() );    }}
开发者ID:GoyaPtyLtd,项目名称:BaseElements-Plugin,代码行数:29,


示例3: tjInitCompress

ofxTurboJpeg::ofxTurboJpeg(){	handleCompress = tjInitCompress();	if (handleCompress == NULL)	{		printf("Error in tjInitCompress():/n%s/n", tjGetErrorStr());	}	handleDecompress = tjInitDecompress();	if (handleDecompress == NULL)	{		printf("Error in tjInitDeCompress():/n%s/n", tjGetErrorStr());	}}
开发者ID:fishkingsin,项目名称:ofxTurboJpeg,代码行数:15,


示例4: _throw

JNIEXPORT jobjectArray JNICALL Java_org_libjpegturbo_turbojpeg_TJ_getScalingFactors	(JNIEnv *env, jclass cls){  jclass sfcls=NULL;  jfieldID fid=0;	tjscalingfactor *sf=NULL;  int n=0, i;	jobject sfobj=NULL;	jobjectArray sfjava=NULL;	if((sf=tjGetScalingFactors(&n))==NULL || n==0)		_throw(tjGetErrorStr());	bailif0(sfcls=(*env)->FindClass(env, "org/libjpegturbo/turbojpeg/TJScalingFactor"));	bailif0(sfjava=(jobjectArray)(*env)->NewObjectArray(env, n, sfcls, 0));	for(i=0; i<n; i++)	{		bailif0(sfobj=(*env)->AllocObject(env, sfcls));		bailif0(fid=(*env)->GetFieldID(env, sfcls, "num", "I"));		(*env)->SetIntField(env, sfobj, fid, sf[i].num);		bailif0(fid=(*env)->GetFieldID(env, sfcls, "denom", "I"));		(*env)->SetIntField(env, sfobj, fid, sf[i].denom);		(*env)->SetObjectArrayElement(env, sfjava, i, sfobj);	}	bailout:	return sfjava;}
开发者ID:Doug-Pardee,项目名称:LightZone,代码行数:27,


示例5: gethandle

JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressHeader	(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize){	tjhandle handle=0;	unsigned char *jpegBuf=NULL;	int width=0, height=0, jpegSubsamp=-1;	gethandle();	if((*env)->GetArrayLength(env, src)<jpegSize)		_throw("Source buffer is not large enough");	bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));	if(tjDecompressHeader2(handle, jpegBuf, (unsigned long)jpegSize, 		&width, &height, &jpegSubsamp)==-1)	{		(*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);		_throw(tjGetErrorStr());	}	(*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);  jpegBuf=NULL;	bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I"));	(*env)->SetIntField(env, obj, _fid, jpegSubsamp);	bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I"));	(*env)->SetIntField(env, obj, _fid, width);	bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I"));	(*env)->SetIntField(env, obj, _fid, height);	bailout:	return;}
开发者ID:Doug-Pardee,项目名称:LightZone,代码行数:32,


示例6: fopen

bool TurboJpegReaderPlugin::getRegionOfDefinition( const OFX::RegionOfDefinitionArguments& args, OfxRectD& rod ){	try	{		FILE *file = NULL;		unsigned char *jpegbuf = NULL;		unsigned long jpgbufsize = 0;		file = fopen( getAbsoluteFilenameAt( args.time ).c_str(), "rb" );		if( file == NULL )		{			BOOST_THROW_EXCEPTION( exception::File()				<< exception::user( "TurboJpeg: Unable to open file" )				<< exception::filename( getAbsoluteFilenameAt( args.time ) ) );		}				fseek( file, 0, SEEK_END );		jpgbufsize = ftell( file );		jpegbuf = new unsigned char[ jpgbufsize ];				fseek(file, 0, SEEK_SET);		fread( jpegbuf, jpgbufsize, 1, file );		const tjhandle jpeghandle = tjInitDecompress();		int width = 0;		int height = 0;		int jpegsubsamp = -1;				int ret = tjDecompressHeader2( jpeghandle, jpegbuf, jpgbufsize, &width, &height, &jpegsubsamp );				if( ret != 0 )		{			BOOST_THROW_EXCEPTION( exception::FileNotExist()				<< exception::user( tjGetErrorStr() )				<< exception::filename( getAbsoluteFilenameAt( args.time ) ) );		}				tjDestroy( jpeghandle );		//free(jpegbuf);		delete[] jpegbuf;		jpegbuf = NULL;				fclose(file);		file=NULL;				rod.x1 = 0;		rod.x2 = width * this->_clipDst->getPixelAspectRatio();		rod.y1 = 0;		rod.y2 = height;		//TUTTLE_COUT_VAR( rod );	}	catch( std::exception& e )	{		BOOST_THROW_EXCEPTION( exception::FileNotExist()			<< exception::user( "TurboJpeg: Unable to open file" )			<< exception::filename( getAbsoluteFilenameAt( args.time ) ) );	}		return true;}
开发者ID:davebarkeruk,项目名称:TuttleOFX,代码行数:60,


示例7: gethandle

/* TurboJPEG 1.2.x: TJDecompressor::decompressToYUV() */JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV	(JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst,		jint flags){	tjhandle handle=0;	unsigned char *jpegBuf=NULL, *dstBuf=NULL;	int jpegSubsamp=-1, jpegWidth=0, jpegHeight=0;	gethandle();	if((*env)->GetArrayLength(env, src)<jpegSize)		_throw("Source buffer is not large enough");	bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I"));	jpegSubsamp=(int)(*env)->GetIntField(env, obj, _fid);	bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I"));	jpegWidth=(int)(*env)->GetIntField(env, obj, _fid);	bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I"));	jpegHeight=(int)(*env)->GetIntField(env, obj, _fid);	if((*env)->GetArrayLength(env, dst)		<(jsize)tjBufSizeYUV(jpegWidth, jpegHeight, jpegSubsamp))		_throw("Destination buffer is not large enough");	bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));	bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));	if(tjDecompressToYUV(handle, jpegBuf, (unsigned long)jpegSize, dstBuf,		flags)==-1)		_throw(tjGetErrorStr());	bailout:	if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);	if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);	return;}
开发者ID:jibuji,项目名称:libjpeg-turbo-1.3.x-android,代码行数:35,


示例8: WriteJpeg

bool WriteJpeg( const char * destinationFile, const unsigned char * rgbxBuffer, int width, int height ){	tjhandle tj = tjInitCompress();	unsigned char * jpegBuf = NULL;	unsigned long jpegSize = 0;	const int r = tjCompress2( tj, ( unsigned char * )rgbxBuffer,	// TJ isn't const correct...		width, width * 4, height, TJPF_RGBX, &jpegBuf,		&jpegSize, TJSAMP_444 /* TJSAMP_422 */, 90 /* jpegQual */, 0 /* flags */ );	if ( r != 0 )	{		LOG_TJ( "tjCompress2 returned %s for %s", tjGetErrorStr(), destinationFile );		return false;	}	FILE * f = fopen( destinationFile, "wb" );	if ( f != NULL )	{		fwrite( jpegBuf, jpegSize, 1, f );		fclose( f );	}	else	{		LOG_TJ( "WriteJpeg failed to write to %s", destinationFile );		return false;	}	tjFree( jpegBuf );	tjDestroy( tj );	return true;}
开发者ID:EusthEnoptEron,项目名称:Mangaroll,代码行数:34,


示例9:

/* TurboJPEG 1.4.x: TJ::planeHeight() */JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeHeight__III	(JNIEnv *env, jclass cls, jint componentID, jint height, jint subsamp){	jint retval=(jint)tjPlaneHeight(componentID, height, subsamp);	if(retval==-1) _throwarg(tjGetErrorStr());	bailout:	return retval;}
开发者ID:Robert-Xie,项目名称:libjpeg-turbo,代码行数:10,


示例10:

JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV	(JNIEnv *env, jclass cls, jint width, jint height, jint subsamp){	jint retval=(jint)tjBufSizeYUV(width, height, subsamp);	if(retval==-1) _throw(tjGetErrorStr());	bailout:	return retval;}
开发者ID:Doug-Pardee,项目名称:LightZone,代码行数:9,


示例11: TurboJpegLoadFromMemory

// Drop-in replacement for stbi_load_from_memory(), but without component specification.// Often 2x - 3x faster.unsigned char * TurboJpegLoadFromMemory( const unsigned char * jpg, const int length, int * width, int * height ){	tjhandle tj = tjInitDecompress();	int	jpegWidth;	int	jpegHeight;	int jpegSubsamp;	int jpegColorspace;	const int headerRet = tjDecompressHeader3( tj,		( unsigned char * )jpg /* tj isn't const correct */, length, &jpegWidth, &jpegHeight,		&jpegSubsamp, &jpegColorspace );	if ( headerRet )	{		LOG_TJ( "TurboJpegLoadFromMemory: header: %s", tjGetErrorStr() );		tjDestroy( tj );		return NULL;	}	const int bufLen = jpegWidth * jpegHeight * 4;	unsigned char * buffer = ( unsigned char * )malloc( bufLen );	if ( buffer != NULL )	{		const int decompRet = tjDecompress2( tj,			( unsigned char * )jpg, length, buffer,			jpegWidth, jpegWidth * 4, jpegHeight, TJPF_RGBX, 0 /* flags */ );		if ( decompRet )		{			LOG_TJ( "TurboJpegLoadFromMemory: decompress: %s", tjGetErrorStr() );			tjDestroy( tj );			free( buffer );			return NULL;		}		tjDestroy( tj );		*width = jpegWidth;		*height = jpegHeight;	}	return buffer;}
开发者ID:EusthEnoptEron,项目名称:Mangaroll,代码行数:42,


示例12: DecodeJpeg

	std::unique_ptr<uint8_t[]> DecodeJpeg(const array_view<uint8_t> data) {		TjDecompressHandle handle;		int w, h;		tjDecompressHeader(handle, &data[0], data.bytes(), &w, &h);		std::unique_ptr<uint8_t[]> result(new uint8_t[w * h * 4]);		auto status = tjDecompress2(handle, &data[0], data.bytes(), &result[0], w, w * 4, h, TJPF_BGRX, 0);		if (status != 0) {			throw TempleException("Unable to decompress jpeg image: {}",			                      tjGetErrorStr());		}		return result;	}
开发者ID:ema29,项目名称:TemplePlus,代码行数:14,


示例13: tjInitCompress

void BEJPEG::compress ( void ){    tjhandle jpeg_compressor = tjInitCompress();    if ( NULL != jpeg_compressor ) {        unsigned long image_size = width * height * tjPixelSize[pixel_format];        std::vector<unsigned char> image ( image_size );        unsigned char * compressed_image = &image[0];        int error = tjCompress2 ( jpeg_compressor, &data[0], width, 0, height, pixel_format, &compressed_image, &image_size, chrominance_subsampling, compression_level, 0 );        tjDestroy ( jpeg_compressor ); // error =        if ( 0 == error ) {            image.resize ( image_size );            data = image;        } else {            throw BEPlugin_Exception ( kJPEGCompressionError, tjGetErrorStr() );        }    } else {        throw BEPlugin_Exception ( kJPEGInitCcompressorError, tjGetErrorStr() );    }}
开发者ID:GoyaPtyLtd,项目名称:BaseElements-Plugin,代码行数:24,


示例14: TurboJpegLoadFromMemory

// Drop-in replacement for stbi_load_from_memory(), but without component specification.// Often 2x - 3x faster.unsigned char * TurboJpegLoadFromMemory( const unsigned char * jpg, const int length, int * width, int * height ){	tjhandle tj = tjInitDecompress();	int	jpegWidth;	int	jpegHeight;	int jpegSubsamp;	int jpegColorspace;	const int headerRet = tjDecompressHeader3( tj,		( unsigned char * )jpg /* tj isn't const correct */, length, &jpegWidth, &jpegHeight,		&jpegSubsamp, &jpegColorspace );	if ( headerRet )	{		LOG( "TurboJpegLoadFromMemory: header: %s", tjGetErrorStr() );		tjDestroy( tj );		return NULL;	}	MemBuffer	tjb( jpegWidth * jpegHeight * 4 );	const int decompRet = tjDecompress2( tj,		( unsigned char * )jpg, length, ( unsigned char * )tjb.Buffer,		jpegWidth, jpegWidth * 4, jpegHeight, TJPF_RGBX, 0 /* flags */ );	if ( decompRet )	{		LOG( "TurboJpegLoadFromMemory: decompress: %s", tjGetErrorStr() );		tjDestroy( tj );		tjb.FreeData();		return NULL;	}	tjDestroy( tj );	*width = jpegWidth;	*height = jpegHeight;	return ( unsigned char * )tjb.Buffer;}
开发者ID:beijingkaka,项目名称:shellspace,代码行数:38,


示例15: tjDecompressHeader2

bool ofxTurboJpeg::load(const ofBuffer& buf, ofPixels &pix){	int w, h;	int subsamp;	int ok = tjDecompressHeader2(handleDecompress, (unsigned char*)buf.getData(), buf.size(), &w, &h, &subsamp);		if (ok != 0)	{		printf("Error in tjDecompressHeader2():/n%s/n", tjGetErrorStr());		return false;	}		pix.allocate(w, h, 3);		tjDecompress(handleDecompress, (unsigned char*)buf.getData(), buf.size(), pix.getData(), w, 0, h, 3, 0);		return true;}
开发者ID:fishkingsin,项目名称:ofxTurboJpeg,代码行数:18,


示例16: gethandle

JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIII_3BIII	(JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch,		jint height, jint pf, jbyteArray dst, jint jpegSubsamp, jint jpegQual,		jint flags){	tjhandle handle=0;	unsigned long jpegSize=0;  jsize arraySize=0;	unsigned char *srcBuf=NULL, *jpegBuf=NULL;	gethandle();	if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF || width<1 || height<1		|| pitch<0)		_throw("Invalid argument in compress()");	if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)		_throw("Mismatch between Java and C API");	arraySize=(pitch==0)? width*tjPixelSize[pf]*height:pitch*height;	if((*env)->GetArrayLength(env, src)<arraySize)		_throw("Source buffer is not large enough");	jpegSize=tjBufSize(width, height, jpegSubsamp);	if((*env)->GetArrayLength(env, dst)<(jsize)jpegSize)		_throw("Destination buffer is not large enough");	bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));	bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));	if(tjCompress2(handle, srcBuf, width, pitch, height, pf, &jpegBuf,		&jpegSize, jpegSubsamp, jpegQual, flags|TJFLAG_NOREALLOC)==-1)	{		(*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0);		(*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);		jpegBuf=srcBuf=NULL;		_throw(tjGetErrorStr());	}	bailout:	if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0);	if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);	return (jint)jpegSize;}
开发者ID:AutomationConsultant,项目名称:perch-webrtc,代码行数:41,


示例17: WriteJpeg

void WriteJpeg( const char * fullName, const unsigned char * rgbxBuffer, int width, int height ){	tjhandle tj = tjInitCompress();	unsigned char * jpegBuf = NULL;	unsigned long jpegSize = 0;	const int r = tjCompress2( tj, ( unsigned char * )rgbxBuffer,	// TJ isn't const correct...		width, width * 4, height, TJPF_RGBX, &jpegBuf,		&jpegSize, TJSAMP_444 /* TJSAMP_422 */, 90 /* jpegQual */, 0 /* flags */ );	if ( r != 0 )	{		LOG( "tjCompress2 returned %s for %s", tjGetErrorStr(), fullName );		return;	}	MemBuffer toFile( jpegBuf, jpegSize );	toFile.WriteToFile( fullName );	tjFree( jpegBuf );	tjDestroy( tj );}
开发者ID:beijingkaka,项目名称:shellspace,代码行数:21,


示例18: loadImage

// Given a filename and an image object, it loads the file with that name into// the object.void loadImage(Image *image, char* filename) {  FILE* jpegfile = fopen(filename, "rb");  if(jpegfile == NULL) {    EPRINT("Error: Unable to open file!/n");    exit(-1);  }  struct stat stbuf;  if ((fstat(fileno(jpegfile), &stbuf) != 0) || (!S_ISREG(stbuf.st_mode))) {    EPRINT("Error: Unable to determine file size!/n");    exit(-1);  }  off_t  filesize = stbuf.st_size;  unsigned char* buffer = malloc(filesize);  if (buffer == NULL) {    EPRINT("Error: Unable to allocate memory for jpeg!/n");    exit(-1);  }  if(fread(buffer, 1, filesize, jpegfile) != filesize) {    EPRINT("Error: Unable to read file!/n");    exit(-1);  }  fclose(jpegfile);  tjhandle decomp;  if(!(decomp = tjInitDecompress())) {    EPRINT("Error: Unable to initialize TurboJPEG decompressor!/n");    EPRINT("%s/n", tjGetErrorStr());    exit(-1);  }  int width, height, jpegSubsamp, jpegColorspace;  if(tjDecompressHeader3(decomp, buffer, filesize, &width, &height, &jpegSubsamp, &jpegColorspace)) {    EPRINT("Error: Unable to read JPEG header!/n");    EPRINT("%s/n", tjGetErrorStr());    exit(-1);  }  image->width = width;  image->height = height;  unsigned long decompressed_size;  decompressed_size = width*height*tjPixelSize[PIXEL_FORMAT];  unsigned char* buffer2 = malloc(decompressed_size);  if(tjDecompress2(decomp, buffer, filesize, buffer2, width, width * tjPixelSize[PIXEL_FORMAT], height, PIXEL_FORMAT, TJFLAG_NOREALLOC)) {    EPRINT("Error: Unable to decompress JPEG image!/n");    EPRINT("%s/n", tjGetErrorStr());    exit(-1);  }  // Free up some memory since we are done with image decoding  tjDestroy(decomp);  free(buffer);  assert(tjPixelSize[PIXEL_FORMAT] == sizeof(Pixel));  image->data = (Pixel *) buffer2;  return;}
开发者ID:InvncibiltyCloak,项目名称:radial_ws281x,代码行数:67,


示例19: check_jpeg

static const char * VS_CCcheck_jpeg(img_hnd_t *ih, int n, FILE *fp, vs_args_t *va){    struct stat st;#ifdef _WIN32    wchar_t tmp[FILENAME_MAX * 2];    MultiByteToWideChar(CP_UTF8, 0, ih->src[n].name, -1, tmp, FILENAME_MAX * 2);    if (wstat(tmp, &st)) {#else    if (stat(ih->src[n].name, &st)) {#endif        return "source file does not exist";    }    ih->src[n].image_size = st.st_size;    if (ih->src_buff_size < st.st_size) {        ih->src_buff_size = st.st_size;        free(ih->src_buff);        ih->src_buff = malloc(ih->src_buff_size);        if (!ih->src_buff) {            return "failed to allocate read buffer";        }    }    unsigned long read = fread(ih->src_buff, 1, st.st_size, fp);    fclose(fp);    if (read < st.st_size) {        return "failed to read jpeg file";    }    int subsample, width, height;    tjhandle handle = (tjhandle)ih->tjhandle;    if (tjDecompressHeader2(handle, ih->src_buff, read, &width, &height,                            &subsample) != 0) {        return tjGetErrorStr();    }    if (subsample == TJSAMP_420 || subsample == TJSAMP_422) {        width += width & 1;    }    if (subsample == TJSAMP_420 || subsample == TJSAMP_440) {        height += height & 1;    }    ih->src[n].width = width;    ih->src[n].height = height;    VSPresetFormat pf = tjsamp_to_vspresetformat(subsample);    ih->src[n].format = va->vsapi->getFormatPreset(pf, va->core);    uint32_t row_size = tjBufSizeYUV(width, height, subsample) / height;    if (row_size > va->max_row_size) {        va->max_row_size = row_size;    }    ih->src[n].read = read_jpeg;    return NULL;}const func_check_src check_src_jpeg = check_jpeg;
开发者ID:darcyg,项目名称:vapoursynth-plugins,代码行数:61,


示例20: gethandle

static void TJDecompressor_decodeYUV	(JNIEnv *env, jobject obj, jobjectArray srcobjs, jintArray jSrcOffsets,		jintArray jSrcStrides, jint subsamp, jarray dst, jint dstElementSize,		jint x, jint y, jint width, jint pitch, jint height, jint pf, jint flags){	tjhandle handle=0;	jsize arraySize=0, actualPitch;	jbyteArray jSrcPlanes[3]={NULL, NULL, NULL};	unsigned char *srcPlanes[3], *dstBuf=NULL;	int *srcOffsets=NULL, *srcStrides=NULL;	int nc=(subsamp==org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY? 1:3), i;	gethandle();	if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF || subsamp<0		|| subsamp>=org_libjpegturbo_turbojpeg_TJ_NUMSAMP)		_throwarg("Invalid argument in decodeYUV()");	if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF		|| org_libjpegturbo_turbojpeg_TJ_NUMSAMP!=TJ_NUMSAMP)		_throwarg("Mismatch between Java and C API");	if((*env)->GetArrayLength(env, srcobjs)<nc)		_throwarg("Planes array is too small for the subsampling type");	if((*env)->GetArrayLength(env, jSrcOffsets)<nc)		_throwarg("Offsets array is too small for the subsampling type");	if((*env)->GetArrayLength(env, jSrcStrides)<nc)		_throwarg("Strides array is too small for the subsampling type");	actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch;	arraySize=(y+height-1)*actualPitch + (x+width)*tjPixelSize[pf];	if((*env)->GetArrayLength(env, dst)*dstElementSize<arraySize)		_throwarg("Destination buffer is not large enough");	bailif0(srcOffsets=(*env)->GetPrimitiveArrayCritical(env, jSrcOffsets, 0));	bailif0(srcStrides=(*env)->GetPrimitiveArrayCritical(env, jSrcStrides, 0));	for(i=0; i<nc; i++)	{		int planeSize=tjPlaneSizeYUV(i, width, srcStrides[i], height, subsamp);		int pw=tjPlaneWidth(i, width, subsamp);		if(planeSize<0 || pw<0)			_throwarg(tjGetErrorStr());		if(srcOffsets[i]<0)			_throwarg("Invalid argument in decodeYUV()");		if(srcStrides[i]<0 && srcOffsets[i]-planeSize+pw<0)			_throwarg("Negative plane stride would cause memory to be accessed below plane boundary");		bailif0(jSrcPlanes[i]=(*env)->GetObjectArrayElement(env, srcobjs, i));		if((*env)->GetArrayLength(env, jSrcPlanes[i])<srcOffsets[i]+planeSize)			_throwarg("Source plane is not large enough");		bailif0(srcPlanes[i]=(*env)->GetPrimitiveArrayCritical(env, jSrcPlanes[i],			0));		srcPlanes[i]=&srcPlanes[i][srcOffsets[i]];	}	bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));	if(tjDecodeYUVPlanes(handle, srcPlanes, srcStrides, subsamp,		&dstBuf[y*actualPitch + x*tjPixelSize[pf]], width, pitch, height, pf,		flags)==-1)		_throwtj();	bailout:	if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);	for(i=0; i<nc; i++)	{		if(srcPlanes[i] && jSrcPlanes[i])			(*env)->ReleasePrimitiveArrayCritical(env, jSrcPlanes[i], srcPlanes[i],				0);	}	if(srcStrides)		(*env)->ReleasePrimitiveArrayCritical(env, jSrcStrides, srcStrides, 0);	if(srcOffsets)		(*env)->ReleasePrimitiveArrayCritical(env, jSrcOffsets, srcOffsets, 0);	return;}
开发者ID:Robert-Xie,项目名称:libjpeg-turbo,代码行数:77,



注:本文中的tjGetErrorStr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tk函数代码示例
C++ title函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。