Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9aec8c3f authored by Mathias Agopian's avatar Mathias Agopian
Browse files

test-resample: clip instead of overflowing

Change-Id: I550e5a59e51c11e1095ca338222b094f92b96878
parent 36a65500
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -206,7 +206,10 @@ int main(int argc, char* argv[]) {
    int32_t* out = (int32_t*) output_vaddr;
    int16_t* convert = (int16_t*) malloc(out_frames * sizeof(int16_t));
    for (size_t i = 0; i < out_frames; i++) {
        convert[i] = out[i * 2] >> 12;
        int32_t s = out[i * 2] >> 12;
        if (s > 32767)       s =  32767;
        else if (s < -32768) s = -32768;
        convert[i] = int16_t(s);
    }

    // write output to disk