Compare commits

..

No commits in common. "079bcfc315f031fec8d21d399d99b904f05ff3d2" and "e33460841b54ee60dea7015603442ed16576856e" have entirely different histories.

5 changed files with 15 additions and 11 deletions

1
src/flac/.gitignore vendored
View File

@ -1 +0,0 @@
version.scm

View File

@ -19,7 +19,7 @@ include $(top_srcdir)/build-aux/am/guile.am
SOURCES = \ SOURCES = \
version.scm \ version.scm \
decoder.scm \ decover.scm \
format.scm \ format.scm \
metadata.scm \ metadata.scm \
reader.scm reader.scm

View File

@ -171,7 +171,7 @@
((between? raw #b100000 #b111111) (values (+ 1 (bit-extract raw 0 5)) 'lpc)) ((between? raw #b100000 #b111111) (values (+ 1 (bit-extract raw 0 5)) 'lpc))
(else (values #f #f))))) (else (values #f #f)))))
;;; https://www.ietf.org/archive/id/draft-ietf-cellar-flac-07.html#name-interchannel-decorrelation ; https://www.ietf.org/archive/id/draft-ietf-cellar-flac-07.html#name-interchannel-decorrelation
(define (stereo-decorrelation samples channel-assignment) (define (stereo-decorrelation samples channel-assignment)
(match channel-assignment (match channel-assignment
('independent samples) ('independent samples)
@ -239,12 +239,13 @@
(residual (read-residual-partitioned-rice blocksize lpc-order))) (residual (read-residual-partitioned-rice blocksize lpc-order)))
(restore-linear-prediction warmup residual coefs lpc-order shift))) (restore-linear-prediction warmup residual coefs lpc-order shift)))
;; TODO: clean up the channel decorrelation this is kind of ugly
(define (read-subframes stream-info frame-header) (define (read-subframes stream-info frame-header)
(let ((channels (stream-info-channels stream-info)) (let ((channels (stream-info-channels stream-info))
(channel-assignment (frame-header-channel-assignment frame-header))) (channel-assignment (frame-header-channel-assignment frame-header)))
(map! (λ (channel) (read-subframe frame-header channel)) (iota channels)))) (map! (λ (channel) (read-subframe frame-header channel)) (iota channels))))
;;; TODO: actually verify the checksum ; TODO: actually verify the checksum
(define (read-frame-footer) (define (read-frame-footer)
(flac-read-uint 16)) (flac-read-uint 16))
@ -261,7 +262,7 @@
(blocksize (decode-block-size raw-blocksize)) (blocksize (decode-block-size raw-blocksize))
(sample-rate (decode-sample-rate stream-info raw-sample-rate)) (sample-rate (decode-sample-rate stream-info raw-sample-rate))
(crc (flac-read-uint 8))) (crc (flac-read-uint 8)))
(%make-frame-header (make-frame-header
blocking-strategy blocking-strategy
blocksize blocksize
sample-rate sample-rate

10
src/flac/tests/utils.scm Normal file
View File

@ -0,0 +1,10 @@
(define-module (flac tests utils)
#:use-module (srfi srfi-64)
#:export (with-tests))
(define-syntax-rule (with-tests name body ...)
(begin
(test-begin name)
body ...
(test-end name)))
; (exit (zero? (test-runner-fail-count (test-end name))))))

View File

@ -10,12 +10,6 @@
#:use-module (srfi srfi-64)) #:use-module (srfi srfi-64))
(define-syntax-rule (with-tests name body ...)
(begin
(test-begin name)
body ...
(test-end name)))
(define-public example-1 (define-public example-1
#vu8(#x66 #x4c #x61 #x43 #x80 #x00 #x00 #x22 #x10 #x00 #x10 #x00 #vu8(#x66 #x4c #x61 #x43 #x80 #x00 #x00 #x22 #x10 #x00 #x10 #x00
#x00 #x00 #x0f #x00 #x00 #x0f #x0a #xc4 #x42 #xf0 #x00 #x00 #x00 #x00 #x0f #x00 #x00 #x0f #x0a #xc4 #x42 #xf0 #x00 #x00