@@ -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,55 +56,60 @@ 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
56
65
* @param rgba - buffer where the decoded data in RGBA format will be stored.
57
66
* It should have a size of (width * height * 4).
58
- * @param dhtMode - Unknown, pass 0
67
+ * @param unk - Unknown, pass 0
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 dhtMode );
71
+ int sceJpegDecodeMJpeg (u8 * jpegbuf , SceSize size , u8 * rgba , u32 unk );
63
72
64
73
/**
65
- * Decodes a mjpeg frame with YCbCr encoding.
74
+ * Reads information from mjpeg frame
66
75
*
67
76
* @param jpegbuf - the buffer with the mjpeg frame
68
- * @param size - size of the buffer pointed by jpegbuf
69
- * @param yCbCr - buffer where the decoded data in YCbCr format will be stored.
70
- * @param yCbCrSize - size of the buffer pointed by yCbCr
71
- * @param dhtMode - Unknown, pass 0
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
72
80
*
73
- * @return (width * 65536) + height on success , < 0 on error
81
+ * @return number of bytes needed in the buffer that will be used for YCbCr decoding , <= 0 on error
74
82
*/
75
- int sceJpegDecodeMJpegYCbCr (u8 * jpegbuf , SceSize jpegSize , u8 * yCbCr , SceSize yCbCrSize , u32 dhtMode );
83
+ int sceJpegGetOutputInfo (u8 * jpegbuf , SceSize size , int * colourInfo , int unk );
76
84
77
85
/**
78
- * Converts a frame from YCbCr to ABGR
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
79
89
*
80
- * @param imageAddr - buffer where the decoded data in abgr format will be stored.
81
- * @param yCbCrAddr - the buffer with the YCbCr data
82
- * @param widthHeight - width and height of the frame (width << 16) | height
83
- * @param bufferWidth - number of pixels per row of the buffer
84
- * @param colourInfo - chroma subsampling mode
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
85
95
*
86
- * @return 0 on success, < 0 on error
96
+ * @return (width * 65536) + height on success, < 0 on error
87
97
*/
88
- int sceJpegCsc (u8 * imageAddr , u8 * yCbCrAddr , int widthHeight , int bufferWidth , int colourInfo );
98
+ int sceJpegDecodeMJpegYCbCr (u8 * jpegbuf , SceSize size , u8 * yCbCr , SceSize yCbCrSize , u32 unk );
89
99
90
100
/**
91
- * Reads information from mjpeg frame
101
+ * Converts a frame from YCbCr to RGBA
92
102
*
93
- * @param jpegbuf - the buffer with the mjpeg frame
94
- * @param size - size of the mjpeg frame
95
- * @param colourInfoAddr - address where the mjpeg chroma information will be stored
96
- * @param dhtMode - Unknown, pass 0
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()
97
109
*
98
110
* @return 0 on success, < 0 on error
99
111
*/
100
- int sceJpegGetOutputInfo (u8 * jpegbuf , SceSize size , int * colourInfoAddr , int dhtMode );
112
+ int sceJpegCsc (u8 * imageAddr , u8 * yCbCrAddr , int widthHeight , int bufferWidth , int colourInfo );
101
113
102
114
#ifdef __cplusplus
103
115
}
0 commit comments