All of lore.kernel.org
 help / color / mirror / Atom feed
From: Siarhei Siamashka <siarhei.siamashka@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: "Frédéric Dalleau" <frederic.dalleau@linux.intel.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 0/5] mSBC tests
Date: Tue, 30 Oct 2012 04:18:50 +0200	[thread overview]
Message-ID: <20121030041850.2bda32b0@i7> (raw)
In-Reply-To: <1348844742.13371.38.camel@aeonflux>

On Fri, 28 Sep 2012 17:05:42 +0200
Marcel Holtmann <marcel@holtmann.org> wrote:

> > > Work done from the spec, not tested with any reference encoder.
> > 
> > Does a reference mSBC encoder exist somewhere? Or any ideas how to test
> > the new code with something other than bluez just to be sure that it's
> > correct?
> 
> I looked at the Bluetooth SIG website and couldn't find a reference
> encoder or sample files. The old SBC reference encoder and decoder don't
> seem to support other block sizes.
> 
> SBC Encoder LIB Version 1.5
> Copyright (c) 2002  Philips Consumer Electronics, ASA Labs
> 
> Usage:
> sbc_encoder [-jsv] [-lblk_len] [-nsubbands] [-p] [-rrate] [-ooutputfile] inputfile
>             [-s] use the stereo mode for stereo signals
>             [-v] verbose mode
>             [-j] allow the use of joint coding for stereo signals
>             [-lblk_len] blk_len specifies the APCM block length, out of [4,8,12,16]
>             [-nsubbands] subbands specifies the number of subbands, out of [4,8]
>             [-p] a simple psycho acoustic model is used
>             [-rrate] specifies the bit rate in bps
>             [-ooutputfile] specifies the name of the bitstream output file
>             inputfile specifies the audio input file, the major audio formats are supported
> 
> 
> SBC Decoder LIB Version 1.5
> Copyright (c) 2002  Philips Consumer Electronics, ASA Labs
> 
> Usage:
> sbc_decoder [-v] [-ooutputfile] [-pstartpos] inputfile
>             [-v] verbose mode
>             [-pstartpos] startpos specifies the byte offset to start with decoding
>             [-ooutputfile] specifies the name of the audio output file
>             inputfile specifies the name of the bitstream input file
> 
> And the sample files are all from 2001. We might have to create our own
> ones and our own naive and stupid reference encoder/decoder.

Hi Marcel,

As the first step, some sort of automated testing ("make check") for
verifying sbc encoding/decoding correctness might be useful.

So far I have been using the following quickly hacked script. It just
takes a directory with *.au files, encodes them using different
settings and provides a log with md5 hashes which can be compared with
the reference log:

#!/usr/bin/env ruby

testfiles = []
Dir.new("testsamples").each {|file|
    next if not file =~ /\.au$/
    testfiles.push("testsamples/" + file)
}

if File.exists?("sbc-test.ok") then
    fh = File.open("sbc-test.ok", "r")
    okdata = fh.read()
    fh.close()
end

outstring = ""

testfiles.sort!

testfiles.each {|file|

    ["-b32", "-b64", "-b128", "-b255"].each {|br|
    ["-s4", "-s8"].each {|sb|
    ["-S", ""].each {|snr|
    ["-j", ""].each {|j|
    ["-d", ""].each {|d|
    ["-B4", "-B8", "-B12", "-B16"].each {|blk|
        outstring += sprintf("%s #{file} (#{br} #{sb} #{snr} #{j} #{d} #{blk})\n",
            `./sbcenc #{br} #{sb} #{snr} #{j} #{d} #{blk} #{file} 2>/dev/null | md5sum`.strip).gsub(/[ ]+/, " ")
    }
    }
    }
    }
    }
    }
}

if not okdata then
    printf("no reference ok data\n")
end

if outstring != okdata then
    printf("test failed!\n")
else
    printf("test ok\n")
end

fh = File.open("sbc-test.results", "w")
fh.write(outstring)
fh.close()

############################

Though I see this scripts as a dead end, because my media files are a
bit too large for adding to a git repository and these files are
all copyrighted. Some of them have a permissive license (big buck
bunny soundtrack), some of them do not.

Anyway, based on the fact that we use a fixed point encoder for sbc and
its output is deterministic, we can just encode some pseudo random noise
data and compare the checksums/hashes of the encoded results with some
reference values.

-- 
Best regards,
Siarhei Siamashka

      reply	other threads:[~2012-10-30  2:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-27 14:44 [PATCH 0/5] mSBC tests Frédéric Dalleau
2012-09-27 14:44 ` [PATCH 1/5] Add msbc encoding and decoding flag Frédéric Dalleau
2012-09-28 14:53   ` Marcel Holtmann
2012-09-27 14:44 ` [PATCH 2/5] Add support for mSBC frame header Frédéric Dalleau
2012-09-28 14:45   ` Marcel Holtmann
2012-09-27 14:44 ` [PATCH 3/5] update sbcdec for msbc Frédéric Dalleau
2012-09-27 14:44 ` [PATCH 4/5] update sbcenc " Frédéric Dalleau
2012-09-27 14:44 ` [PATCH 5/5] update sbcinfo " Frédéric Dalleau
2012-09-27 20:34 ` [PATCH 0/5] mSBC tests Siarhei Siamashka
2012-09-28  8:21   ` Dalleau, Frederic
2012-09-28 15:05   ` Marcel Holtmann
2012-10-30  2:18     ` Siarhei Siamashka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121030041850.2bda32b0@i7 \
    --to=siarhei.siamashka@gmail.com \
    --cc=frederic.dalleau@linux.intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.