1#This work is licensed under the 2#Creative Commons Attribution-Share Alike 3.0 United States License. 3#To view a copy of this license, visit 4#http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to 5#Creative Commons, 6#171 Second Street, Suite 300, 7#San Francisco, California, 94105, USA. 8 9INPUT "WavPack file stream"; 10OUTPUT channel_count,final_block,block_index,block_samples,total_samples,block_channel; 11VAR channel_count "channel count"; 12VAR initial_block "initial block"; 13VAR final_block "final block"; 14VAR block_index "block index"; 15VAR block_samples "block samples"; 16VAR total_samples "total samples"; 17VAR block_channel "block channel"; 18VAR block_data_size "block data size"; 19VAR mono_output "mono output"; 20VAR joint_stereo "joint stereo"; 21VAR bits_per_sample "bits-per-sample"; 22VAR channel_decorrelation "channel decorrelation"; 23VAR extended_size_integers "extended size integers"; 24VAR false_stereo "false stereo"; 25VAR CRC "CRC"; 26VAR decorrelation_term_count "term count"; 27VAR decorrelation_terms "decorrelation terms"; 28VAR decorrelation_deltas "decorrelation deltas"; 29VAR decorrelation_weights "decorrelation weights"; 30VAR decorrelation_samples "decorrelation samples"; 31VAR entropies "entropy"; 32VAR residuals "residuals"; 33VAR zero_bits "zero bits"; 34VAR one_bits "one bits"; 35VAR duplicate_bits "duplicate bits"; 36FUNC read_block_header "read block header" "wavpack:read_block_header"; 37FUNC read_block_parameters "read block parameters" 38"wavpack:read_block_parameters"; 39FUNC decorrelate_channels "decorrelate channels" 40"wavpack:decorrelate_channels"; 41FUNC undo_joint_stereo "undo joint stereo" "wavpack:undo_joint_stereo"; 42FUNC apply_extended_integers "apply extended integers" 43"wavpack:apply_extended_integers"; 44 45block_data_size, 46total_samples, 47block_index, 48block_samples, 49mono_output, 50joint_stereo, 51channel_decorrelation, 52extended_size_integers, 53final_block, 54false_stereo, 55CRC <- 56read_block_header(); 57if (mono_output == 0) and (false_stereo == 0) { 58 channel_count <- 2; 59} else { 60 channel_count <- 1; 61} 62decorrelation_term_count, 63decorrelation_terms, 64decorrelation_deltas, 65decorrelation_weights, 66decorrelation_samples, 67residuals, 68zero_bits,one_bits,duplicate_bits <- read_block_parameters( 69block_data_size, block_samples, channel_count); 70 71if channel_decorrelation == 1 { 72 block_channel <- decorrelate_channels(block_samples, 73 channel_count, 74 residuals, 75 decorrelation_term_count, 76 decorrelation_terms, 77 decorrelation_deltas, 78 decorrelation_weights, 79 decorrelation_samples); 80} else { 81 block_channel <- residuals; 82} 83if (channel_count == 2) and (joint_stereo == 1) { 84 block_channel <- undo_joint_stereo(block_samples, block_channel); 85} 86if extended_size_integers == 1 { 87 block_channel <- apply_extended_integers(block_channel, 88 zero_bits, 89 one_bits, 90 duplicate_bits, 91 block_samples, 92 channel_count); 93} 94if false_stereo == 1 { 95 block_channel[1] <- block_channel[0]; 96} 97return channel_count, 98final_block, 99block_index, 100block_samples, 101total_samples, 102block_channel; 103