/* TurboJPEG 1.2.x: TJCompressor::encodeYUV() byte source */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII
	(JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch,
		jint height, jint pf, jbyteArray dst, jint subsamp, jint flags)
{
	TJCompressor_encodeYUV(env, obj, src, 1, width, pitch, height, pf, dst,
		subsamp, flags);
}
/* TurboJPEG 1.4.x: TJCompressor::encodeYUV() byte source */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3_3B_3I_3III
	(JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width,
		jint pitch, jint height, jint pf, jobjectArray dstobjs,
		jintArray jDstOffsets, jintArray jDstStrides, jint subsamp, jint flags)
{
	TJCompressor_encodeYUV(env, obj, src, 1, x, y, width, pitch, height, pf,
		dstobjs, jDstOffsets, jDstStrides, subsamp, flags);
}
/* TurboJPEG 1.2.x: TJCompressor::encodeYUV() int source */
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BII
	(JNIEnv *env, jobject obj, jintArray src, jint width, jint stride,
		jint height, jint pf, jbyteArray dst, jint subsamp, jint flags)
{
	if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF)
		_throw("Invalid argument in encodeYUV()");
	if(tjPixelSize[pf]!=sizeof(jint))
		_throw("Pixel format must be 32-bit when encoding from an integer buffer.");

	TJCompressor_encodeYUV(env, obj, src, sizeof(jint), width,
		stride*sizeof(jint), height, pf, dst, subsamp, flags);

	bailout:
	return;
}