#This work is licensed under the
#Creative Commons Attribution-Share Alike 3.0 United States License.
#To view a copy of this license, visit
#http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to
#Creative Commons,
#171 Second Street, Suite 300,
#San Francisco, California, 94105, USA.

INPUT "WavPack file stream",channel_count;
OUTPUT "a list of 3 signed entropy value integers per channel";
VAR entropy "entropy";
VAR channel_count "channel count";
FUNC decode_wv_exp2 "decode wv_exp2" "wavpack:exp2";
entropy[0][0] <- decode_wv_exp2(read 16 signed);
entropy[0][1] <- decode_wv_exp2(read 16 signed);
entropy[0][2] <- decode_wv_exp2(read 16 signed);
if channel_count == 1 {
    entropy[1][0],
    entropy[1][1],
    entropy[1][2] <- 0;
} else {
    entropy[1][0] <- decode_wv_exp2(read 16 signed);
    entropy[1][1] <- decode_wv_exp2(read 16 signed);
    entropy[1][2] <- decode_wv_exp2(read 16 signed);
}
return entropy;
