Merge "Delete simple reduction implementation."
This commit is contained in:
@@ -752,20 +752,12 @@ public class RenderScript {
|
|||||||
rsnScriptForEach(mContext, id, slot, ains, aout, params, limits);
|
rsnScriptForEach(mContext, id, slot, ains, aout, params, limits);
|
||||||
}
|
}
|
||||||
|
|
||||||
native void rsnScriptReduce(long con, long id, int slot, long ain,
|
native void rsnScriptReduce(long con, long id, int slot, long[] ains,
|
||||||
long aout, int[] limits);
|
long aout, int[] limits);
|
||||||
synchronized void nScriptReduce(long id, int slot, long ain, long aout,
|
synchronized void nScriptReduce(long id, int slot, long ains[], long aout,
|
||||||
int[] limits) {
|
int[] limits) {
|
||||||
validate();
|
validate();
|
||||||
rsnScriptReduce(mContext, id, slot, ain, aout, limits);
|
rsnScriptReduce(mContext, id, slot, ains, aout, limits);
|
||||||
}
|
|
||||||
|
|
||||||
native void rsnScriptReduceNew(long con, long id, int slot, long[] ains,
|
|
||||||
long aout, int[] limits);
|
|
||||||
synchronized void nScriptReduceNew(long id, int slot, long ains[], long aout,
|
|
||||||
int[] limits) {
|
|
||||||
validate();
|
|
||||||
rsnScriptReduceNew(mContext, id, slot, ains, aout, limits);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
native void rsnScriptInvokeV(long con, long id, int slot, byte[] params);
|
native void rsnScriptInvokeV(long con, long id, int slot, byte[] params);
|
||||||
|
|||||||
@@ -285,35 +285,6 @@ public class Script extends BaseObj {
|
|||||||
mRS.nScriptForEach(getID(mRS), slot, in_ids, out_id, params, limits);
|
mRS.nScriptForEach(getID(mRS), slot, in_ids, out_id, params, limits);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Only intended for use by generated reflected code. (Simple reduction)
|
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
protected void reduce(int slot, Allocation ain, Allocation aout, LaunchOptions sc) {
|
|
||||||
mRS.validate();
|
|
||||||
mRS.validateObject(ain);
|
|
||||||
mRS.validateObject(aout);
|
|
||||||
|
|
||||||
if (ain == null || aout == null) {
|
|
||||||
throw new RSIllegalArgumentException(
|
|
||||||
"Both ain and aout are required to be non-null.");
|
|
||||||
}
|
|
||||||
|
|
||||||
long in_id = ain.getID(mRS);
|
|
||||||
long out_id = aout.getID(mRS);
|
|
||||||
|
|
||||||
int[] limits = null;
|
|
||||||
if (sc != null) {
|
|
||||||
limits = new int[2];
|
|
||||||
|
|
||||||
limits[0] = sc.xstart;
|
|
||||||
limits[1] = sc.xend;
|
|
||||||
}
|
|
||||||
|
|
||||||
mRS.nScriptReduce(getID(mRS), slot, in_id, out_id, limits);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only intended for use by generated reflected code. (General reduction)
|
* Only intended for use by generated reflected code. (General reduction)
|
||||||
*
|
*
|
||||||
@@ -351,7 +322,7 @@ public class Script extends BaseObj {
|
|||||||
limits[5] = sc.zend;
|
limits[5] = sc.zend;
|
||||||
}
|
}
|
||||||
|
|
||||||
mRS.nScriptReduceNew(getID(mRS), slot, in_ids, out_id, limits);
|
mRS.nScriptReduce(getID(mRS), slot, in_ids, out_id, limits);
|
||||||
}
|
}
|
||||||
|
|
||||||
long[] mInIdsBuffer;
|
long[] mInIdsBuffer;
|
||||||
|
|||||||
@@ -2106,67 +2106,10 @@ nScriptForEach(JNIEnv *_env, jobject _this, jlong con, jlong script, jint slot,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
nScriptReduce(JNIEnv *_env, jobject _this, jlong con, jlong script, jint slot,
|
nScriptReduce(JNIEnv *_env, jobject _this, jlong con, jlong script, jint slot,
|
||||||
jlong ain, jlong aout, jintArray limits)
|
|
||||||
{
|
|
||||||
if (kLogApi) {
|
|
||||||
ALOGD("nScriptReduce, con(%p), s(%p), slot(%i) ain(%" PRId64 ") aout(%" PRId64 ")", (RsContext)con, (void *)script, slot, ain, aout);
|
|
||||||
}
|
|
||||||
|
|
||||||
RsScriptCall sc, *sca = nullptr;
|
|
||||||
uint32_t sc_size = 0;
|
|
||||||
|
|
||||||
jint limit_len = 0;
|
|
||||||
jint *limit_ptr = nullptr;
|
|
||||||
|
|
||||||
// If the caller passed limits, reflect them in the RsScriptCall.
|
|
||||||
if (limits != nullptr) {
|
|
||||||
limit_len = _env->GetArrayLength(limits);
|
|
||||||
limit_ptr = _env->GetIntArrayElements(limits, nullptr);
|
|
||||||
if (limit_ptr == nullptr) {
|
|
||||||
ALOGE("Failed to get Java array elements");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We expect to be passed an array [x1, x2] which specifies
|
|
||||||
// the sub-range for a 1-dimensional reduction.
|
|
||||||
assert(limit_len == 2);
|
|
||||||
UNUSED(limit_len); // As the assert might not be compiled.
|
|
||||||
|
|
||||||
sc.xStart = limit_ptr[0];
|
|
||||||
sc.xEnd = limit_ptr[1];
|
|
||||||
sc.yStart = 0;
|
|
||||||
sc.yEnd = 0;
|
|
||||||
sc.zStart = 0;
|
|
||||||
sc.zEnd = 0;
|
|
||||||
sc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE;
|
|
||||||
sc.arrayStart = 0;
|
|
||||||
sc.arrayEnd = 0;
|
|
||||||
sc.array2Start = 0;
|
|
||||||
sc.array2End = 0;
|
|
||||||
sc.array3Start = 0;
|
|
||||||
sc.array3End = 0;
|
|
||||||
sc.array4Start = 0;
|
|
||||||
sc.array4End = 0;
|
|
||||||
|
|
||||||
sca = ≻
|
|
||||||
sc_size = sizeof(sc);
|
|
||||||
}
|
|
||||||
|
|
||||||
rsScriptReduce((RsContext)con, (RsScript)script, slot,
|
|
||||||
(RsAllocation)ain, (RsAllocation)aout,
|
|
||||||
sca, sc_size);
|
|
||||||
|
|
||||||
if (limits != nullptr) {
|
|
||||||
_env->ReleaseIntArrayElements(limits, limit_ptr, JNI_ABORT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nScriptReduceNew(JNIEnv *_env, jobject _this, jlong con, jlong script, jint slot,
|
|
||||||
jlongArray ains, jlong aout, jintArray limits)
|
jlongArray ains, jlong aout, jintArray limits)
|
||||||
{
|
{
|
||||||
if (kLogApi) {
|
if (kLogApi) {
|
||||||
ALOGD("nScriptReduceNew, con(%p), s(%p), slot(%i) ains(%p) aout(%" PRId64 ")", (RsContext)con, (void *)script, slot, ains, aout);
|
ALOGD("nScriptReduce, con(%p), s(%p), slot(%i) ains(%p) aout(%" PRId64 ")", (RsContext)con, (void *)script, slot, ains, aout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ains == nullptr) {
|
if (ains == nullptr) {
|
||||||
@@ -2245,7 +2188,7 @@ nScriptReduceNew(JNIEnv *_env, jobject _this, jlong con, jlong script, jint slot
|
|||||||
sc_size = sizeof(sc);
|
sc_size = sizeof(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
rsScriptReduceNew((RsContext)con, (RsScript)script, slot,
|
rsScriptReduce((RsContext)con, (RsScript)script, slot,
|
||||||
in_allocs, in_len, (RsAllocation)aout,
|
in_allocs, in_len, (RsAllocation)aout,
|
||||||
sca, sc_size);
|
sca, sc_size);
|
||||||
|
|
||||||
@@ -2963,8 +2906,7 @@ static const JNINativeMethod methods[] = {
|
|||||||
{"rsnScriptInvokeV", "(JJI[B)V", (void*)nScriptInvokeV },
|
{"rsnScriptInvokeV", "(JJI[B)V", (void*)nScriptInvokeV },
|
||||||
|
|
||||||
{"rsnScriptForEach", "(JJI[JJ[B[I)V", (void*)nScriptForEach },
|
{"rsnScriptForEach", "(JJI[JJ[B[I)V", (void*)nScriptForEach },
|
||||||
{"rsnScriptReduce", "(JJIJJ[I)V", (void*)nScriptReduce },
|
{"rsnScriptReduce", "(JJI[JJ[I)V", (void*)nScriptReduce },
|
||||||
{"rsnScriptReduceNew", "(JJI[JJ[I)V", (void*)nScriptReduceNew },
|
|
||||||
|
|
||||||
{"rsnScriptSetVarI", "(JJII)V", (void*)nScriptSetVarI },
|
{"rsnScriptSetVarI", "(JJII)V", (void*)nScriptSetVarI },
|
||||||
{"rsnScriptGetVarI", "(JJI)I", (void*)nScriptGetVarI },
|
{"rsnScriptGetVarI", "(JJI)I", (void*)nScriptGetVarI },
|
||||||
|
|||||||
Reference in New Issue
Block a user