wut v1.9.1
Wii U Toolchain
Loading...
Searching...
No Matches
stream.h
Go to the documentation of this file.
1#pragma once
2#include <wut.h>
3
10#ifdef __cplusplus
11extern "C" {
12#endif
13
17
18typedef void (*H264DECFptrOutputFn)(H264DecodeOutput *output);
19
49
87WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x00, aspect_ratio_info_present_flag);
88WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x01, aspect_ratio_idc);
89WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x02, sar_width);
90WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x04, sar_height);
91WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x06, overscan_info_present_flag);
92WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x07, overscan_appropriate_flag);
93WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x08, video_signal_type_present_flag);
94WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x09, video_format);
95WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0A, video_full_range_flag);
96WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0B, colour_description_present_flag);
97WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0C, colour_primaries);
98WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0D, transfer_characteristics);
99WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0E, matrix_coefficients);
100WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x0F, chroma_loc_info_present_flag);
101WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x10, chroma_sample_loc_type_top_field);
102WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x11, chroma_sample_loc_type_bottom_field);
103WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x12, timing_info_present_flag);
104WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x14, num_units_in_tick);
105WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x18, time_scale);
106WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x1C, fixed_frame_rate_flag);
107WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x1D, nal_hrd_parameters_present_flag);
108WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x1E, vcl_hrd_parameters_present_flag);
109WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x1F, low_delay_hrd_flag);
110WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x20, pic_struct_present_flag);
111WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x21, bitstream_restriction_flag);
112WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x22, motion_vectors_over_pic_boundaries_flag);
113WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x24, max_bytes_per_pic_denom);
114WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x26, max_bits_per_mb_denom);
115WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x28, log2_max_mv_length_horizontal);
116WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x2A, log2_max_mv_length_vertical);
117WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x2C, num_reorder_frames);
118WUT_CHECK_OFFSET(H264DecodedVuiParameters, 0x2E, max_dec_frame_buffering);
119WUT_CHECK_SIZE(H264DecodedVuiParameters, 0x30);
120
121struct WUT_PACKED H264DecodeResult
122{
123 int32_t status;
124 WUT_PADDING_BYTES(4);
125 double timestamp;
126 int32_t width;
127 int32_t height;
128 int32_t nextLine;
130 WUT_PADDING_BYTES(3);
131 int32_t cropTop;
132 int32_t cropBottom;
133 int32_t cropLeft;
134 int32_t cropRight;
136 WUT_PADDING_BYTES(3);
137 int32_t panScanTop;
139 int32_t panScanLeft;
143 WUT_PADDING_BYTES(3);
145 WUT_UNKNOWN_BYTES(40);
146};
147WUT_CHECK_OFFSET(H264DecodeResult, 0x00, status);
148WUT_CHECK_OFFSET(H264DecodeResult, 0x08, timestamp);
149WUT_CHECK_OFFSET(H264DecodeResult, 0x10, width);
150WUT_CHECK_OFFSET(H264DecodeResult, 0x14, height);
151WUT_CHECK_OFFSET(H264DecodeResult, 0x18, nextLine);
152WUT_CHECK_OFFSET(H264DecodeResult, 0x1C, cropEnableFlag);
153WUT_CHECK_OFFSET(H264DecodeResult, 0x20, cropTop);
154WUT_CHECK_OFFSET(H264DecodeResult, 0x24, cropBottom);
155WUT_CHECK_OFFSET(H264DecodeResult, 0x28, cropLeft);
156WUT_CHECK_OFFSET(H264DecodeResult, 0x2C, cropRight);
157WUT_CHECK_OFFSET(H264DecodeResult, 0x30, panScanEnableFlag);
158WUT_CHECK_OFFSET(H264DecodeResult, 0x34, panScanTop);
159WUT_CHECK_OFFSET(H264DecodeResult, 0x38, panScanBottom);
160WUT_CHECK_OFFSET(H264DecodeResult, 0x3C, panScanLeft);
161WUT_CHECK_OFFSET(H264DecodeResult, 0x40, panScanRight);
162WUT_CHECK_OFFSET(H264DecodeResult, 0x44, framebuffer);
163WUT_CHECK_OFFSET(H264DecodeResult, 0x48, vui_parameters_present_flag);
164WUT_CHECK_OFFSET(H264DecodeResult, 0x4C, vui_parameters);
165WUT_CHECK_SIZE(H264DecodeResult, 0x78);
166
167struct WUT_PACKED H264DecodeOutput
168{
170 int32_t frameCount;
171
174
177};
178WUT_CHECK_OFFSET(H264DecodeOutput, 0x00, frameCount);
179WUT_CHECK_OFFSET(H264DecodeOutput, 0x04, decodeResults);
180WUT_CHECK_OFFSET(H264DecodeOutput, 0x08, userMemory);
181WUT_CHECK_SIZE(H264DecodeOutput, 0x0C);
182
183
189 const uint8_t *buffer,
190 int32_t bufferLength,
191 int32_t offset,
192 int32_t *outLength);
193
194
199H264DECCheckSkipableFrame(const uint8_t *buffer,
200 int32_t bufferLength,
201 BOOL *outSkippable);
202
203
208H264DECFindDecstartpoint(const uint8_t *buffer,
209 int32_t bufferLength,
210 int32_t *outOffset);
211
212
221int32_t
222H264DECFindIdrpoint(const uint8_t *buffer,
223 int32_t bufferLength,
224 int32_t *outOffset);
225
226
231H264DECGetImageSize(const uint8_t *buffer,
232 int32_t bufferLength,
233 int32_t offset,
234 int32_t *outWidth,
235 int32_t *outHeight);
236
237
238#ifdef __cplusplus
239}
240#endif
241
int16_t max_bits_per_mb_denom
Definition stream.h:81
uint8_t chroma_sample_loc_type_top_field
Definition stream.h:66
int16_t log2_max_mv_length_horizontal
Definition stream.h:82
uint8_t overscan_appropriate_flag
Definition stream.h:57
uint32_t num_units_in_tick
Definition stream.h:70
uint8_t chroma_sample_loc_type_bottom_field
Definition stream.h:67
double timestamp
Definition stream.h:125
int32_t status
Definition stream.h:123
int32_t width
Definition stream.h:126
int16_t num_reorder_frames
Definition stream.h:84
int32_t panScanRight
Definition stream.h:140
int32_t cropRight
Definition stream.h:134
uint8_t vcl_hrd_parameters_present_flag
Definition stream.h:74
int32_t height
Definition stream.h:127
int32_t cropBottom
Definition stream.h:132
uint8_t motion_vectors_over_pic_boundaries_flag
Definition stream.h:78
int16_t max_bytes_per_pic_denom
Definition stream.h:80
int16_t log2_max_mv_length_vertical
Definition stream.h:83
uint8_t vui_parameters_present_flag
Definition stream.h:142
uint8_t aspect_ratio_info_present_flag
Definition stream.h:52
uint8_t low_delay_hrd_flag
Definition stream.h:75
uint8_t pic_struct_present_flag
Definition stream.h:76
int32_t panScanTop
Definition stream.h:137
H264DecodeResult ** decodeResults
Frames.
Definition stream.h:173
void * userMemory
User memory pointer passed into SetParam.
Definition stream.h:176
H264DecodedVuiParameters * vui_parameters
Definition stream.h:144
uint8_t video_full_range_flag
Definition stream.h:60
int32_t cropLeft
Definition stream.h:133
uint8_t overscan_info_present_flag
Definition stream.h:56
int32_t nextLine
Definition stream.h:128
uint8_t cropEnableFlag
Definition stream.h:129
uint8_t bitstream_restriction_flag
Definition stream.h:77
int32_t panScanLeft
Definition stream.h:139
uint8_t chroma_loc_info_present_flag
Definition stream.h:65
void * framebuffer
Definition stream.h:141
uint8_t timing_info_present_flag
Definition stream.h:68
uint8_t transfer_characteristics
Definition stream.h:63
uint8_t panScanEnableFlag
Definition stream.h:135
uint8_t fixed_frame_rate_flag
Definition stream.h:72
uint8_t colour_description_present_flag
Definition stream.h:61
int32_t frameCount
Number of frames output.
Definition stream.h:170
int16_t max_dec_frame_buffering
Definition stream.h:85
uint8_t nal_hrd_parameters_present_flag
Definition stream.h:73
uint8_t matrix_coefficients
Definition stream.h:64
uint8_t video_signal_type_present_flag
Definition stream.h:58
int32_t cropTop
Definition stream.h:131
int32_t panScanBottom
Definition stream.h:138
void(* H264DECFptrOutputFn)(H264DecodeOutput *output)
Definition stream.h:18
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:22
@ H264_ERROR_GENERIC
Generic h264 error.
Definition stream.h:36
@ H264_ERROR_INVALID_SLICEHEADER
Invalid slice header.
Definition stream.h:33
@ H264_ERROR_OUT_OF_MEMORY
The amount of memory provided to the h264 library is insufficient.
Definition stream.h:43
@ H264_ERROR_INVALID_PARAMETER
Invalid parameters passed.
Definition stream.h:39
@ H264_ERROR_OK
No errors.
Definition stream.h:24
@ H264_ERROR_INVALID_SPS
Invalid sequence parameter set.
Definition stream.h:30
@ H264_ERROR_INVALID_PPS
Invalid picture parameter set.
Definition stream.h:27
@ H264_ERROR_INVALID_PROFILE
Invalid h264 stream profile.
Definition stream.h:47
int32_t BOOL
Definition wut_types.h:7