summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/user/jpegarm.h103
-rw-r--r--nids/360/SceJpegArm.yml13
2 files changed, 116 insertions, 0 deletions
diff --git a/include/user/jpegarm.h b/include/user/jpegarm.h
new file mode 100644
index 0000000..6a5f5c7
--- /dev/null
+++ b/include/user/jpegarm.h
@@ -0,0 +1,103 @@
+#ifndef _DOLCESDK_PSP2_JPEGARM_H_
+#define _DOLCESDK_PSP2_JPEGARM_H_
+
+#include <psp2/types.h>
+#include <psp2/jpeg.h>
+
+#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
+extern "C" {
+#endif
+
+/* Error codes */
+#define SCE_JPEG_ARM_OK (SCE_JPEG_OK)
+
+#define SCE_JPEG_ARM_ERROR_IMAGE_EMPTY (SCE_JPEG_ERROR_IMAGE_EMPTY | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_MARKER_LENGTH (SCE_JPEG_ERROR_BAD_MARKER_LENGTH | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_DHT_COUNTS (SCE_JPEG_ERROR_BAD_DHT_COUNTS | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_DHT_INDEX (SCE_JPEG_ERROR_BAD_DHT_INDEX | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_DQT_INDEX (SCE_JPEG_ERROR_BAD_DQT_INDEX | 0x100)
+#define SCE_JPEG_ARM_ERROR_DECODE_ERROR (SCE_JPEG_ERROR_DECODE_ERROR | 0x100)
+#define SCE_JPEG_ARM_ERROR_INVALID_POINTER (SCE_JPEG_ERROR_INVALID_POINTER | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_COMPONENT_ID (SCE_JPEG_ERROR_BAD_COMPONENT_ID | 0x100)
+#define SCE_JPEG_ARM_ERROR_UNSUPPORT_COLORSPACE (SCE_JPEG_ERROR_UNSUPPORT_COLORSPACE | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_MCU_SIZE (SCE_JPEG_ERROR_BAD_MCU_SIZE | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_PRECISION (SCE_JPEG_ERROR_BAD_PRECISION | 0x100)
+#define SCE_JPEG_ARM_ERROR_UNSUPPORT_SAMPLING (SCE_JPEG_ERROR_UNSUPPORT_SAMPLING | 0x100)
+#define SCE_JPEG_ARM_ERROR_COMPONENT_COUNT (SCE_JPEG_ERROR_COMPONENT_COUNT | 0x100)
+#define SCE_JPEG_ARM_ERROR_EOI_EXPECTED (SCE_JPEG_ERROR_EOI_EXPECTED | 0x100)
+#define SCE_JPEG_ARM_ERROR_UNSUPPORT_IMAGE_SIZE (SCE_JPEG_ERROR_UNSUPPORT_IMAGE_SIZE | 0x100)
+#define SCE_JPEG_ARM_ERROR_NO_HUFF_TABLE (SCE_JPEG_ERROR_NO_HUFF_TABLE | 0x100)
+#define SCE_JPEG_ARM_ERROR_NO_QUANT_TABLE (SCE_JPEG_ERROR_NO_QUANT_TABLE | 0x100)
+#define SCE_JPEG_ARM_ERROR_NO_SOI (SCE_JPEG_ERROR_NO_SOI | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_DHT_MARKER (SCE_JPEG_ERROR_BAD_DHT_MARKER | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_DRI_MARKER (SCE_JPEG_ERROR_BAD_DRI_MARKER | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_SOF_MARKER (SCE_JPEG_ERROR_BAD_SOF_MARKER | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_SOS_MARKER (SCE_JPEG_ERROR_BAD_SOS_MARKER | 0x100)
+#define SCE_JPEG_ARM_ERROR_SOF_DUPLICATE (SCE_JPEG_ERROR_SOF_DUPLICATE | 0x100)
+#define SCE_JPEG_ARM_ERROR_NO_LOSSLESS_SUPPORT (SCE_JPEG_ERROR_NO_LOSSLESS_SUPPORT | 0x100)
+#define SCE_JPEG_ARM_ERROR_NO_ARITH_SUPPORT (SCE_JPEG_ERROR_NO_ARITH_SUPPORT | 0x100)
+#define SCE_JPEG_ARM_ERROR_UNKNOWN_MARKER (SCE_JPEG_ERROR_UNKNOWN_MARKER | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_RESTART_MARKER (SCE_JPEG_ERROR_BAD_RESTART_MARKER | 0x100)
+#define SCE_JPEG_ARM_ERROR_UNEXPECTED_MARKER (SCE_JPEG_ERROR_UNEXPECTED_MARKER | 0x100)
+#define SCE_JPEG_ARM_ERROR_INVALID_REGION (SCE_JPEG_ERROR_INVALID_REGION | 0x100)
+#define SCE_JPEG_ARM_ERROR_INVALID_STATE (SCE_JPEG_ERROR_INVALID_STATE | 0x100)
+#define SCE_JPEG_ARM_ERROR_CANNOT_CONTINUE (SCE_JPEG_ERROR_CANNOT_CONTINUE | 0x100)
+#define SCE_JPEG_ARM_ERROR_MEMORY_SIZE (SCE_JPEG_ERROR_MEMORY_SIZE | 0x100)
+#define SCE_JPEG_ARM_ERROR_INVALID_COLOR_FORMAT (SCE_JPEG_ERROR_INVALID_COLOR_FORMAT | 0x100)
+#define SCE_JPEG_ARM_ERROR_INVALID_DECODE_MODE (SCE_JPEG_ERROR_INVALID_DECODE_MODE | 0x100)
+#define SCE_JPEG_ARM_ERROR_BAD_PROGRESSIVE_PARAM (SCE_JPEG_ERROR_BAD_PROGRESSIVE_PARAM | 0x100)
+#define SCE_JPEG_ARM_ERROR_INIT_DONE (SCE_JPEG_ERROR_INIT_DONE | 0x100)
+#define SCE_JPEG_ARM_ERROR_INPUT_SUSPENDED (SCE_JPEG_ERROR_INPUT_SUSPENDED | 0x100)
+#define SCE_JPEG_ARM_ERROR_INPUT_DATA_TOO_BIG (SCE_JPEG_ERROR_INPUT_DATA_TOO_BIG | 0x100)
+#define SCE_JPEG_ARM_ERROR_INVALID_DATA_SIZE (SCE_JPEG_ERROR_INVALID_DATA_SIZE | 0x100)
+
+/* for backward compatibility */
+#define SCE_JPEG_ARM_ERROR_UNSUPPORT_DOWNSCALE (SCE_JPEG_ARM_ERROR_INVALID_DECODE_MODE)
+#define SCE_JPEG_ARM_ERROR_OUT_OF_MEMORY (SCE_JPEG_ARM_ERROR_MEMORY_SIZE)
+
+/* Decode JPEG data to RGBA format */
+int sceJpegArmDecodeMJpeg(
+ const unsigned char *pJpeg,
+ SceSize isize,
+ void *pRGBA,
+ SceSize osize,
+ int decodeMode,
+ void *pCoefBuffer,
+ SceSize coefBufferSize);
+
+/* Decode JPEG data (no color conversion) */
+int sceJpegArmDecodeMJpegYCbCr(
+ const unsigned char *pJpeg,
+ SceSize isize,
+ unsigned char *pYCbCr,
+ SceSize osize,
+ int decodeMode,
+ void *pCoefBuffer,
+ SceSize coefBufferSize);
+
+/* tempBufferSize is always 0, even when using colour space conversion */
+typedef SceJpegOutputInfo SceJpegArmOutputInfo;
+
+/* Return color space and each buffer sizes required when decoding a JPEG image */
+int sceJpegArmGetOutputInfo(
+ const unsigned char *pJpeg,
+ SceSize isize,
+ int outputFormat,
+ int decodeMode,
+ SceJpegArmOutputInfo *pOutputInfo);
+
+/* Split decoder (control struct is different from sceJpeg, no reference anywhere in the apps)
+ * These functions cannot be used at the moment.
+ */
+
+int sceJpegArmCreateSplitDecoder(void *pCtrl);
+int sceJpegArmDeleteSplitDecoder(void *pCtrl);
+
+int sceJpegArmSplitDecodeMJpeg(void *pCtrl);
+
+#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
+}
+#endif
+
+#endif /* _DOLCESDK_PSP2_JPEGARM_H_ */
+
diff --git a/nids/360/SceJpegArm.yml b/nids/360/SceJpegArm.yml
new file mode 100644
index 0000000..235f5c4
--- /dev/null
+++ b/nids/360/SceJpegArm.yml
@@ -0,0 +1,13 @@
+modules:
+ SceJpegArm:
+ nid: 0xC3ACF942
+ libraries:
+ SceJpegArm:
+ nid: 0x19F04693
+ functions:
+ sceJpegArmCreateSplitDecoder: 0x9DA48DB6
+ sceJpegArmDecodeMJpeg: 0xA4ABFCE3
+ sceJpegArmDecodeMJpegYCbCr: 0xE9B1B86F
+ sceJpegArmDeleteSplitDecoder: 0xE9CB3DFD
+ sceJpegArmGetOutputInfo: 0x23AE3BEA
+ sceJpegArmSplitDecodeMJpeg: 0x5D83C606