From: PHO Date: Sun, 10 Jul 2011 09:24:24 +0000 (+0900) Subject: skeleton for Words.getWordsLossless X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=365b1dae494f312138453d98bd4243b2d495585b;p=wavpack.git skeleton for Words.getWordsLossless --- diff --git a/Codec/Audio/WavPack/Words.hs b/Codec/Audio/WavPack/Words.hs index 0923547..36471e1 100644 --- a/Codec/Audio/WavPack/Words.hs +++ b/Codec/Audio/WavPack/Words.hs @@ -1,5 +1,7 @@ {-# LANGUAGE BangPatterns + , FlexibleContexts + , ScopedTypeVariables , UnboxedTuples , UnicodeSyntax #-} @@ -13,6 +15,8 @@ import Codec.Audio.WavPack.Internal import Data.Bits import Data.Bitstream.Generic (Bitstream) import qualified Data.Bitstream.Generic as B +import Data.Int +import qualified Data.Vector.Generic as GV import Data.Word import Prelude.Unicode @@ -30,13 +34,26 @@ data WordsData } deriving (Eq, Show) --- This is an optimized version of 'getWord' that is used for lossless --- only (error_limit ≡ 0). Also, rather than obtaining a single --- sample, it can be used to obtain an entire buffer of either mono or --- stereo samples. ---getWordsLossless ∷ +-- | This is an optimized version of 'getWord' that is used for +-- lossless only ('edErrorLimit' ≡ 0). Also, rather than obtaining a +-- single sample, it can be used to obtain an entire buffer of either +-- mono or stereo samples. +getWordsLossless ∷ ∀bs n v. (Bitstream bs, Integral n, GV.Vector v Int32) + ⇒ Bool -- ^ Is the stream monaural? + → WordsData + → bs -- ^ WV bitstream. + → n -- ^ Number of samples to get. + → (# WordsData, bs, v Int32 #) +{-# INLINEABLE getWordsLossless #-} +getWordsLossless isMono w bs nSamples0 + = error "FIXME" + where + nSamples ∷ n + nSamples = if isMono + then nSamples0 + else nSamples0 ⋅ 2 --- Read a single unsigned value from the specified bitstream with a +-- | Read a single unsigned value from the specified bitstream with a -- value from 0 to maxCode. If there are exactly a power of two number -- of possible codes then this will read a fixed number of bits; -- otherwise it reads the minimum number of bits and then determines