/**
 * @param {Uint8Array} input
 * @param {number} width
 * @param {number} height
 * @param {number} channel_count
 */
export function sampler2d_flipY_in_place(input, width, height, channel_count = 4) {
    const row_size = width * channel_count;
    let t, x0, x1;
    let i = 0;
    const column_count = height >> 1;

    for (; i < column_count; i++) {

        //swap lines
        const k = (height - i - 1) * row_size;
        const m = i * row_size;

        for (let j = 0; j < row_size; j++) {
            x0 = m + j;
            x1 = k + j;

            t = input[x0];

            input[x0] = input[x1];
            input[x1] = t;
        }

    }
}
