wut v1.8.0
Wii U Toolchain
Loading...
Searching...
No Matches
stream.h
Go to the documentation of this file.
1#pragma once
2
9#ifdef __cplusplus
10extern "C" {
11#endif
12
16
17typedef void (*H264DECFptrOutputFn)(H264DecodeOutput *output);
18
48
86WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x00, aspect_ratio_info_present_flag);
87WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x01, aspect_ratio_idc);
88WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x02, sar_width);
89WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x04, sar_height);
90WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x06, overscan_info_present_flag);
91WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x07, overscan_appropriate_flag);
92WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x08, video_signal_type_present_flag);
93WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x09, video_format);
94WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0A, video_full_range_flag);
95WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0B, colour_description_present_flag);
96WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0C, colour_primaries);
97WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0D, transfer_characteristics);
98WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0E, matrix_coefficients);
99WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0F, chroma_loc_info_present_flag);
100WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x10, chroma_sample_loc_type_top_field);
101WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x11, chroma_sample_loc_type_bottom_field);
102WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x12, timing_info_present_flag);
103WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x14, num_units_in_tick);
104WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x18, time_scale);
105WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x1C, fixed_frame_rate_flag);
106WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x1D, nal_hrd_parameters_present_flag);
107WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x1E, vcl_hrd_parameters_present_flag);
108WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x1F, low_delay_hrd_flag);
109WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x20, pic_struct_present_flag);
110WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x21, bitstream_restriction_flag);
111WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x22, motion_vectors_over_pic_boundaries_flag);
112WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x24, max_bytes_per_pic_denom);
113WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x26, max_bits_per_mb_denom);
114WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x28, log2_max_mv_length_horizontal);
115WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x2A, log2_max_mv_length_vertical);
116WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x2C, num_reorder_frames);
117WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x2E, max_dec_frame_buffering);
118WUT_CHECK_SIZE(H264DecodedVuiParameters, 0x30);
119
120struct WUT_PACKED H264DecodeResult
121{
122 int32_t status;
123 WUT_PADDING_BYTES(4);
124 double timestamp;
125 int32_t width;
126 int32_t height;
127 int32_t nextLine;
129 WUT_PADDING_BYTES(3);
130 int32_t cropTop;
131 int32_t cropBottom;
132 int32_t cropLeft;
133 int32_t cropRight;
135 WUT_PADDING_BYTES(3);
136 int32_t panScanTop;
138 int32_t panScanLeft;
142 WUT_PADDING_BYTES(3);
144 WUT_UNKNOWN_BYTES(40);
145};
146WUT_CHECK_OFFSET(H264DecodeResult, 0x00, status);
147WUT_CHECK_OFFSET(H264DecodeResult, 0x08, timestamp);
148WUT_CHECK_OFFSET(H264DecodeResult, 0x10, width);
149WUT_CHECK_OFFSET(H264DecodeResult, 0x14, height);
150WUT_CHECK_OFFSET(H264DecodeResult, 0x18, nextLine);
151WUT_CHECK_OFFSET(H264DecodeResult, 0x1C, cropEnableFlag);
152WUT_CHECK_OFFSET(H264DecodeResult, 0x20, cropTop);
153WUT_CHECK_OFFSET(H264DecodeResult, 0x24, cropBottom);
154WUT_CHECK_OFFSET(H264DecodeResult, 0x28, cropLeft);
155WUT_CHECK_OFFSET(H264DecodeResult, 0x2C, cropRight);
156WUT_CHECK_OFFSET(H264DecodeResult, 0x30, panScanEnableFlag);
157WUT_CHECK_OFFSET(H264DecodeResult, 0x34, panScanTop);
158WUT_CHECK_OFFSET(H264DecodeResult, 0x38, panScanBottom);
159WUT_CHECK_OFFSET(H264DecodeResult, 0x3C, panScanLeft);
160WUT_CHECK_OFFSET(H264DecodeResult, 0x40, panScanRight);
161WUT_CHECK_OFFSET(H264DecodeResult, 0x44, framebuffer);
162WUT_CHECK_OFFSET(H264DecodeResult, 0x48, vui_parameters_present_flag);
163WUT_CHECK_OFFSET(H264DecodeResult, 0x4C, vui_parameters);
164WUT_CHECK_SIZE(H264DecodeResult, 0x78);
165
166struct WUT_PACKED H264DecodeOutput
167{
169 int32_t frameCount;
170
173
176};
177WUT_CHECK_OFFSET(H264DecodeOutput, 0x00, frameCount);
178WUT_CHECK_OFFSET(H264DecodeOutput, 0x04, decodeResults);
179WUT_CHECK_OFFSET(H264DecodeOutput, 0x08, userMemory);
180WUT_CHECK_SIZE(H264DecodeOutput, 0x0C);
181
182
188 const uint8_t *buffer,
189 int32_t bufferLength,
190 int32_t offset,
191 int32_t *outLength);
192
193
198H264DECCheckSkipableFrame(const uint8_t *buffer,
199 int32_t bufferLength,
200 BOOL *outSkippable);
201
202
207H264DECFindDecstartpoint(const uint8_t *buffer,
208 int32_t bufferLength,
209 int32_t *outOffset);
210
211
220int32_t
221H264DECFindIdrpoint(const uint8_t *buffer,
222 int32_t bufferLength,
223 int32_t *outOffset);
224
225
230H264DECGetImageSize(const uint8_t *buffer,
231 int32_t bufferLength,
232 int32_t offset,
233 int32_t *outWidth,
234 int32_t *outHeight);
235
236
237#ifdef __cplusplus
238}
239#endif
240
int16_t max_bits_per_mb_denom
Definition stream.h:80
uint8_t chroma_sample_loc_type_top_field
Definition stream.h:65
int16_t log2_max_mv_length_horizontal
Definition stream.h:81
uint8_t overscan_appropriate_flag
Definition stream.h:56
uint32_t num_units_in_tick
Definition stream.h:69
uint8_t chroma_sample_loc_type_bottom_field
Definition stream.h:66
double timestamp
Definition stream.h:124
int32_t status
Definition stream.h:122
int32_t width
Definition stream.h:125
int16_t num_reorder_frames
Definition stream.h:83
int32_t panScanRight
Definition stream.h:139
int32_t cropRight
Definition stream.h:133
uint8_t vcl_hrd_parameters_present_flag
Definition stream.h:73
int32_t height
Definition stream.h:126
int32_t cropBottom
Definition stream.h:131
uint8_t motion_vectors_over_pic_boundaries_flag
Definition stream.h:77
int16_t max_bytes_per_pic_denom
Definition stream.h:79
int16_t log2_max_mv_length_vertical
Definition stream.h:82
uint8_t vui_parameters_present_flag
Definition stream.h:141
uint8_t aspect_ratio_info_present_flag
Definition stream.h:51
uint8_t low_delay_hrd_flag
Definition stream.h:74
uint8_t pic_struct_present_flag
Definition stream.h:75
int32_t panScanTop
Definition stream.h:136
H264DecodeResult ** decodeResults
Frames.
Definition stream.h:172
void * userMemory
User memory pointer passed into SetParam.
Definition stream.h:175
H264DecodedVuiParameters * vui_parameters
Definition stream.h:143
uint8_t video_full_range_flag
Definition stream.h:59
int32_t cropLeft
Definition stream.h:132
uint8_t overscan_info_present_flag
Definition stream.h:55
int32_t nextLine
Definition stream.h:127
uint8_t cropEnableFlag
Definition stream.h:128
uint8_t bitstream_restriction_flag
Definition stream.h:76
int32_t panScanLeft
Definition stream.h:138
uint8_t chroma_loc_info_present_flag
Definition stream.h:64
void * framebuffer
Definition stream.h:140
uint8_t timing_info_present_flag
Definition stream.h:67
uint8_t transfer_characteristics
Definition stream.h:62
uint8_t panScanEnableFlag
Definition stream.h:134
uint8_t fixed_frame_rate_flag
Definition stream.h:71
uint8_t colour_description_present_flag
Definition stream.h:60
int32_t frameCount
Number of frames output.
Definition stream.h:169
int16_t max_dec_frame_buffering
Definition stream.h:84
uint8_t nal_hrd_parameters_present_flag
Definition stream.h:72
uint8_t matrix_coefficients
Definition stream.h:63
uint8_t video_signal_type_present_flag
Definition stream.h:57
int32_t cropTop
Definition stream.h:130
int32_t panScanBottom
Definition stream.h:137
void(* H264DECFptrOutputFn)(H264DecodeOutput *output)
Definition stream.h:17
H264Error H264DECGetImageSize(const uint8_t *buffer, int32_t bufferLength, int32_t offset, int32_t *outWidth, int32_t *outHeight)
Parse the H264 stream and read the width & height from the first found SPS.
H264Error H264DECCheckSkipableFrame(const uint8_t *buffer, int32_t bufferLength, BOOL *outSkippable)
Check if the next NALU can be skipped without breaking decoding.
H264Error H264DECFindDecstartpoint(const uint8_t *buffer, int32_t bufferLength, int32_t *outOffset)
Find the first SPS in the stream.
H264Error H264DECCheckDecunitLength(void *memory, const uint8_t *buffer, int32_t bufferLength, int32_t offset, int32_t *outLength)
Check that the stream contains sufficient data to decode an entire frame.
int32_t H264DECFindIdrpoint(const uint8_t *buffer, int32_t bufferLength, int32_t *outOffset)
Find the first "IDR point" in the stream.
H264Error
h264 library errors.
Definition stream.h:21
@ H264_ERROR_GENERIC
Generic h264 error.
Definition stream.h:35
@ H264_ERROR_INVALID_SLICEHEADER
Invalid slice header.
Definition stream.h:32
@ H264_ERROR_OUT_OF_MEMORY
The amount of memory provided to the h264 library is insufficient.
Definition stream.h:42
@ H264_ERROR_INVALID_PARAMETER
Invalid parameters passed.
Definition stream.h:38
@ H264_ERROR_OK
No errors.
Definition stream.h:23
@ H264_ERROR_INVALID_SPS
Invalid sequence parameter set.
Definition stream.h:29
@ H264_ERROR_INVALID_PPS
Invalid picture parameter set.
Definition stream.h:26
@ H264_ERROR_INVALID_PROFILE
Invalid h264 stream profile.
Definition stream.h:46
int32_t BOOL
Definition wut_types.h:7