This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void convertNV21ToArray2d(JNIEnv* env, dlib::array2d<dlib::rgb_pixel>& out, | |
jbyteArray data, jint width, jint height) { | |
jbyte* yuv = env->GetByteArrayElements(data, 0); | |
int frameSize = width * height; | |
int y, u, v, uvIndex; | |
int r, g, b; | |
out.set_size((long) height, (long) width); | |
for(int row = 0; row < height; row++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void convertNV21ToArray2d(JNIEnv* env, dlib::array2d<dlib::rgb_pixel>& out, | |
jbyteArray data, jint width, jint height) { | |
jbyte* yuv = env->GetByteArrayElements(data, 0); | |
int frameSize = width * height; | |
int y, u, v, uvIndex; | |
int r, g, b; | |
out.set_size((long) height, (long) width); | |
for(int row = 0; row < height; row++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun observable1() = | |
Observable.fromCallable { | |
print("new callable 1\n") | |
true | |
} | |
fun observable2() = | |
Observable.fromCallable { | |
print("new callable 2\n") | |
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OnSubscribeRenderer(private val surfaceView: GLSurfaceView, | |
private val previewSize: Size) : Observable<SurfaceEvent>() { | |
// TODO make a github gist and ask to community for insights | |
override fun subscribeActual(observer: Observer<in SurfaceEvent>) { | |
val listener = Listener(observer, previewSize) | |
observer.onSubscribe(listener) | |
surfaceView.setEGLContextClientVersion(2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OnSubscribeRenderer(private val surfaceView: GLSurfaceView, | |
private val previewSize: Size) : Observable<SurfaceEvent>() { | |
// TODO make a github gist and ask to community for insights | |
override fun subscribeActual(observer: Observer<in SurfaceEvent>) { | |
val listener = Listener(observer, previewSize) | |
observer.onSubscribe(listener) | |
surfaceView.setEGLContextClientVersion(2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun loadFirstPage(): ObservableTransformer<LoadFirstPageAction, MainResult> { | |
return ObservableTransformer { | |
actionStream -> actionStream.flatMap { _ -> mainModel.getNews("", "10") // <-- whats wrong with you! took 1 day of my life | |
.map { data -> MainResult.success(data) } | |
.onErrorReturn { error -> MainResult.failure(error.message ?: "Unknown error") } | |
.observeOn(AndroidSchedulers.mainThread()) | |
.startWith { MainResult.loading()} } | |
} | |
} |