7 if (b > SIZE_MAX - a)
return 0;
13 if (a && b > SIZE_MAX / a)
return 0;
19 const int32_t *durations,
23 if (!durations || !limits || !shape || !phoneme_count ||
32 memset(shape, 0,
sizeof(*shape));
36 for (
size_t i = 0; i < phoneme_count; ++i) {
40 if (!
checked_add(frames, (
size_t)durations[i], &frames))
46 size_t align, decoder, generator, istft_frames, padded, output;
56 if (align > SIZE_MAX /
sizeof(
float) ||
57 decoder > SIZE_MAX /
sizeof(
float) ||
58 generator > SIZE_MAX /
sizeof(
float) ||
59 padded > SIZE_MAX /
sizeof(
float) ||
60 output > SIZE_MAX /
sizeof(
float)) {
@ CK_AUDIO_EXTENT_INVALID
@ CK_AUDIO_EXTENT_OVERFLOW
int ck_kokoro_plan_shape_v8(const int32_t *durations, size_t phoneme_count, const CKKokoroShapeLimitsV8 *limits, CKKokoroShapeV8 *shape)
static int checked_add(size_t a, size_t b, size_t *out)
static int checked_mul(size_t a, size_t b, size_t *out)
size_t max_duration_per_phoneme
size_t max_alignment_elements
size_t decoder_upsample_factor
size_t max_expanded_frames
size_t alignment_channels
size_t generator_upsample_rate_0
size_t max_output_samples
size_t max_generator_samples
size_t generator_upsample_rate_1
size_t alignment_elements
size_t output_samples_upper_bound
size_t istft_padded_samples