INNER CODE UNIT · C

expanded_length

1oom-fork/1oom · src/fmt_sfx.c:112

    expanded_length = (uint32_t) ((((uint64_t) s_in->num) * audiorate) / s_in->samplerate);
    s_out.num = expanded_length;
    /* Allocate a chunk in which to expand the sound */
    s_out.data = lib_malloc(expanded_length * 2/*16b*/ * 2/*stereo*/);

    expand_ratio = (s_in->num << 8) / s_out.num;

    for (i = 0; i < s_out.num; ++i) {
        int src;
        src = (i * expand_ratio) >> 8;
        s_out.data[i * 2 + 0] = s_in->data[src * 2 + 0];
        s_out.data[i * 2 + 1] = s_in->data[src * 2 + 1];
    }

#ifdef LOW_PASS_FILTER
    /* Perform a low-pass filter on the upscaled sound to filter
       out high-frequency noise from the conversion process. */
    if (s_in->samplerate < audiorate) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…