Skip to content

Commit 6dced23

Browse files
More documentation for pspjpeg.h
1 parent e794711 commit 6dced23

File tree

1 file changed

+36
-24
lines changed

1 file changed

+36
-24
lines changed

src/mpeg/pspjpeg.h

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ extern "C" {
1717

1818
#include <psptypes.h>
1919

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+
2027
/**
2128
* Inits the MJpeg library
2229
*
@@ -49,55 +56,60 @@ int sceJpegCreateMJpeg(int width, int height);
4956
int sceJpegDeleteMJpeg(void);
5057

5158
/**
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
5362
*
5463
* @param jpegbuf - the buffer with the mjpeg frame
5564
* @param size - size of the buffer pointed by jpegbuf
5665
* @param rgba - buffer where the decoded data in RGBA format will be stored.
5766
* It should have a size of (width * height * 4).
58-
* @param dhtMode - Unknown, pass 0
67+
* @param unk - Unknown, pass 0
5968
*
6069
* @return (width * 65536) + height on success, < 0 on error
6170
*/
62-
int sceJpegDecodeMJpeg(u8 *jpegbuf, SceSize size, void *rgba, u32 dhtMode);
71+
int sceJpegDecodeMJpeg(u8 *jpegbuf, SceSize size, u8 *rgba, u32 unk);
6372

6473
/**
65-
* Decodes a mjpeg frame with YCbCr encoding.
74+
* Reads information from mjpeg frame
6675
*
6776
* @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
7280
*
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
7482
*/
75-
int sceJpegDecodeMJpegYCbCr(u8 *jpegbuf, SceSize jpegSize, u8 *yCbCr, SceSize yCbCrSize, u32 dhtMode);
83+
int sceJpegGetOutputInfo(u8 *jpegbuf, SceSize size, int *colourInfo, int unk);
7684

7785
/**
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
7989
*
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
8595
*
86-
* @return 0 on success, < 0 on error
96+
* @return (width * 65536) + height on success, < 0 on error
8797
*/
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);
8999

90100
/**
91-
* Reads information from mjpeg frame
101+
* Converts a frame from YCbCr to RGBA
92102
*
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()
97109
*
98110
* @return 0 on success, < 0 on error
99111
*/
100-
int sceJpegGetOutputInfo(u8* jpegbuf, SceSize size, int* colourInfoAddr, int dhtMode);
112+
int sceJpegCsc(u8 *imageAddr, u8 *yCbCrAddr, int widthHeight, int bufferWidth, int colourInfo);
101113

102114
#ifdef __cplusplus
103115
}

0 commit comments

Comments
 (0)