Package com.gdflab.gdfsr
Class GDFUpscaler
- java.lang.Object
-
- com.gdflab.gdfsr.GDFUpscaler
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class GDFUpscaler extends java.lang.Object implements java.io.Closeable
GDFUpscaler class upscale image and enhance image quality.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GDFUpscaler.DelegateType
Tensorflow Lite delegate types.
-
Field Summary
Fields Modifier and Type Field Description (package private) static NativeWrapper
nativeWrap
static boolean
VERBOSE
Detail logging enabled/disabled.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearBuffers()
void
close()
GDFContext
conv2RGBf(GDFContext ctx)
GDFContext
conv2YUVf(java.nio.ByteBuffer inp, int extra_ival)
int
getScale()
static GDFUpscaler
getUpscaler(int scale, int width, int height)
Get GDFUpscaler instance from upscaling scale and input video resolution.static boolean
initialize(android.content.Context context)
Initialize with android context.void
upscale(GDFContext ctx)
-
-
-
Field Detail
-
nativeWrap
static NativeWrapper nativeWrap
-
VERBOSE
public static boolean VERBOSE
Detail logging enabled/disabled.
-
-
Method Detail
-
initialize
public static boolean initialize(android.content.Context context) throws GDFUpscaleException
Initialize with android context. Needed for validate OpenGL ES version, and get device model name to select appropriate model. Must be called before use of any API.- Parameters:
context
- Android context instance(getApplicationContext() from any Activity).- Throws:
GDFUpscaleException
- When device is not supported.
-
getUpscaler
public static GDFUpscaler getUpscaler(int scale, int width, int height) throws GDFUpscaleException
Get GDFUpscaler instance from upscaling scale and input video resolution.- Parameters:
scale
- Upscaling scale.width
- Input video width.height
- Input video height.- Returns:
- GDFUpscaler instance.
- Throws:
GDFUpscaleException
- When can't get appropriate model or not initialized.
-
conv2YUVf
public GDFContext conv2YUVf(java.nio.ByteBuffer inp, int extra_ival) throws GDFUpscaleException
- Throws:
GDFUpscaleException
-
upscale
public void upscale(GDFContext ctx) throws GDFUpscaleException
- Throws:
GDFUpscaleException
-
conv2RGBf
public GDFContext conv2RGBf(GDFContext ctx) throws GDFUpscaleException
- Throws:
GDFUpscaleException
-
clearBuffers
public void clearBuffers()
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
getScale
public int getScale()
-
-