@@ -17,6 +17,13 @@ extern "C" {
17
17
18
18
#include <psptypes.h>
19
19
20
+ #define SCE_JPEG_ERROR_BAD_MARKER_LENGTH (0x80650004)
21
+ #define SCE_JPEG_ERROR_INVALID_POINTER (0x80650010)
22
+ #define SCE_JPEG_ERROR_UNSUPPORT_COLORSPACE (0x80650013)
23
+ #define SCE_JPEG_ERROR_UNSUPPORT_SAMPLING (0x80650016)
24
+ #define SCE_JPEG_ERROR_UNSUPPORT_IMAGE_SIZE (0x80650020)
25
+ #define SCE_JPEG_ERROR_UNKNOWN_MARKER (0x80650035)
26
+
20
27
/**
21
28
* Inits the MJpeg library
22
29
*
@@ -49,7 +56,9 @@ int sceJpegCreateMJpeg(int width, int height);
49
56
int sceJpegDeleteMJpeg (void );
50
57
51
58
/**
52
- * Decodes a mjpeg frame.
59
+ * Decodes a mjpeg frame to RGBA encoding.
60
+ * @note Input frame should be encoded as either yuv420p or yuvj420p,
61
+ * returns SCE_JPEG_ERROR_UNSUPPORT_SAMPLING otherwise
53
62
*
54
63
* @param jpegbuf - the buffer with the mjpeg frame
55
64
* @param size - size of the buffer pointed by jpegbuf
@@ -59,7 +68,48 @@ int sceJpegDeleteMJpeg(void);
59
68
*
60
69
* @return (width * 65536) + height on success, < 0 on error
61
70
*/
62
- int sceJpegDecodeMJpeg (u8 * jpegbuf , SceSize size , void * rgba , u32 unk );
71
+ int sceJpegDecodeMJpeg (u8 * jpegbuf , SceSize size , u8 * rgba , u32 unk );
72
+
73
+ /**
74
+ * Reads information from mjpeg frame
75
+ *
76
+ * @param jpegbuf - the buffer with the mjpeg frame
77
+ * @param size - size of the mjpeg frame
78
+ * @param colourInfo - address where the mjpeg chroma information will be stored
79
+ * @param unk - Unknown, pass 0
80
+ *
81
+ * @return number of bytes needed in the buffer that will be used for YCbCr decoding, <= 0 on error
82
+ */
83
+ int sceJpegGetOutputInfo (u8 * jpegbuf , SceSize size , int * colourInfo , int unk );
84
+
85
+ /**
86
+ * Decodes a mjpeg frame to YCbCr encoding
87
+ * @note Input frame should be encoded as either yuv420p or yuvj420p,
88
+ * returns SCE_JPEG_ERROR_UNSUPPORT_SAMPLING otherwise
89
+ *
90
+ * @param jpegbuf - the buffer with the mjpeg frame
91
+ * @param size - size of the buffer pointed by jpegbuf
92
+ * @param yCbCr - buffer where the decoded data in YCbCr format will be stored
93
+ * @param yCbCrSize - size of the buffer pointed by yCbCr (see sceJpegGetOutputInfo())
94
+ * @param unk - Unknown, pass 0
95
+ *
96
+ * @return (width * 65536) + height on success, < 0 on error
97
+ */
98
+ int sceJpegDecodeMJpegYCbCr (u8 * jpegbuf , SceSize size , u8 * yCbCr , SceSize yCbCrSize , u32 unk );
99
+
100
+ /**
101
+ * Converts a frame from YCbCr to RGBA
102
+ *
103
+ * @param imageAddr - buffer where the converted data in RGBA format will be stored.
104
+ * @param yCbCrAddr - the buffer with the YCbCr data
105
+ * @param widthHeight - width and height of the frame (width * 65536) + height,
106
+ * as returned by sceJpegDecodeMJpegYCbCr() or sceJpegDecodeMJpeg()
107
+ * @param bufferWidth - number of pixels per row of the buffer
108
+ * @param colourInfo - chroma subsampling mode, as provided by sceJpegGetOutputInfo()
109
+ *
110
+ * @return 0 on success, < 0 on error
111
+ */
112
+ int sceJpegCsc (u8 * imageAddr , u8 * yCbCrAddr , int widthHeight , int bufferWidth , int colourInfo );
63
113
64
114
#ifdef __cplusplus
65
115
}
0 commit comments