func ResampleBytes(data []byte, bitsPerSample int) []uint32
ResampleBytes resamples the raw data which is in 8-bit (byte) format as a different bit count per sample, up to 32 bits (uint32).
func ResampleUint32(data []uint32, bitsPerInputSample int, bitsPerOutputSample int) []uint32
ResampleUint32 resamples the raw data which is in <=32-bit (uint32) format as a different bit count per sample, up to 32 bits (uint32).
bitsPerOutputSample is the number of bits for each output sample (up to 32) bitsPerInputSample is the number of bits used in each input sample (up to 32)
Reader allows to get samples from provided image
type Reader struct {
// contains filtered or unexported fields
}
func NewReader(img imageutil.ImageBase) *Reader
NewReader creates new image based sample reader with specified bitsPerOutputSample.
func (r *Reader) ReadSample() (uint32, error)
ReadSample gets next sample from the reader. If there is no more samples, the function returns an error.
func (r *Reader) ReadSamples(samples []uint32) (err error)
ReadSamples reads as many samples as possible up to the size of provided slice.
SampleReader is an interface that allows to read samples.
type SampleReader interface { ReadSample() (uint32, error) ReadSamples(samples []uint32) error }
SampleWriter allows to write single or multiple samples at once.
type SampleWriter interface { WriteSample(sample uint32) error WriteSamples(samples []uint32) error }
Writer allows to get samples from provided image
type Writer struct {
// contains filtered or unexported fields
}
func NewWriter(img imageutil.ImageBase) *Writer
NewWriter creates new sample writer for provided input 'img'.
func (w *Writer) WriteSample(sample uint32) error
WriteSample writes the sample into given writer.
func (w *Writer) WriteSamples(samples []uint32) error
WriteSamples writes multiple samples at once.