Subject: [codec] Conformance with unusual sample rates

From: John Ridges <[email-masked]>
Date: Fri, 18 Nov 2011 07:29:02 -0700

Hi,

Since the codec conformance is a hot topic right now, I thought I would 
ask a (probably dumb) question. Is it possible to create a conforming 
(and thus unencumbered) Opus codec from the reference implementation 
that can use a sample rate of, say, 44100 Hz? If so, what are the rules 
that would guarantee conformance? Thanks,

John Ridges

---

From: Gregory Maxwell <[email-masked]>
Date: Fri, 18 Nov 2011 07:18:11 -0800

> that would guarantee conformance? Thanks,

The _correct way_ to use Opus with 44100 Hz is to use a resampler. 

This is, for example, how the opus-tools package uses the reference
library to support any input and output sampling rates the user desires,
transparently and painlessly. (https://git.xiph.org/?p=users/jm/opus-tools.git)

Personally, I think that it's most accurate to think of Opus as a sample-rateless
format. Any rate can go into the encoder, you get packets out at 2.5-120ms 
intervals, and any rate can come out of the decoder.  For particular rates
(8000,12000,16000,24000,48000) the conversion from opus to audio is extra
efficient so those are the ones that the reference library supports directly.
(But not other rates because platform specific optimized resampling would
do better)

The computational cost of a resampler is not significant compared to
the codec, there is no quality impact from a reasonable resampler. Any
other option and you'd suffer from loss of coding efficiency, loss of
interoperability, lost of on the fly mode agility, etc.

---

From: "Benjamin M. Schwartz" <[email-masked]>
Date: Fri, 18 Nov 2011 10:56:20 -0500

On 11/18/2011 09:29 AM, John Ridges wrote:
> Is it possible to create a conforming (and
> thus unencumbered) Opus codec from the reference implementation that can
> use a sample rate of, say, 44100 Hz?

It depends what you mean.

One answer is "no".  Opus always operates at a fixed nominal samplerate of
48000 Hz.

Another answer is "yes", because you are of course always free to resample
your inputs before encoding, and to resample the outputs after decoding.
If you figure out a way to use less CPU by integrating your resampler into
the decoder then that's just a trivial implementation detail.

Another answer is "yes, in Opus-custom".  Opus-custom is a
non-interoperable Opus-derived codec development system, defined as part
of the Opus standard [1].  Opus-custom can be driven at different
samplerates, including 44100 Hz.

--Ben

P.S. I do agree that clarifying our text on this point might be helpful.

[1] http://tools.ietf.org/html/draft-ietf-codec-opus-10#section-6.2

---

From: Gregory Maxwell <[email-masked]>
Date: Fri, 18 Nov 2011 08:07:52 -0800

> One answer is "no".  Opus always operates at a fixed nominal samplerate of

It's not really any more true to say 48k there than to say 8k, 12k, 16k, 24k other
than the fact that you'd timestamp it at 48k. 

Which is why I think it's most accurate to describe it as rate-less.

---

From: John Ridges <[email-masked]>
Date: Fri, 18 Nov 2011 09:20:49 -0700

Thank-you for clarifying that. I also have another application where I 
need to use 16 ms frames and it looks like Opus-custom would allow me to 
do that.

John Ridges

---

From: Stephan Wenger <[email-masked]>
Date: Sat, 19 Nov 2011 06:16:46 +0800

Hi,
Whether a conforming opus implementation is indeed "unencumbered" is not
for us to decide.  The one thing conformance should buy you is that you
can rely on the assurances provided in the IPR declarations against opus.
Arguably, even ALL of those create encumbrances, for example restriction
in your use of your own patents due to reciprocity conditions and whatnot.
Stephan

On 11.18.2011 22:29 , "John Ridges" <[email-masked]> wrote:

>_______________________________________________
>codec mailing list
>[email-masked]
>https://www.ietf.org/mailman/listinfo/codec

---

From: John Ridges <[email-masked]>
Date: Fri, 18 Nov 2011 15:26:10 -0700

I agree that it was a poor choice of words on my part. What I really 
wanted to know was whether I could use Opus in a particular way without 
violating the terms of the IPR declarations, and that question has been 
answered to my satisfaction.

John Ridges

On 11/18/2011 3:16 PM, Stephan Wenger wrote:
> On 11.18.2011 22:29 , "John Ridges"<[email-masked]>  wrote:
>
>> Hi,
>>

---

From: Stephan Wenger <[email-masked]>
Date: Sat, 19 Nov 2011 06:26:14 +0800

Uh.  Scary discussion.
I believe we may well be unchartered territory here.  Remember the "green
light / red light" discussion we had here in Taipei?  I'm fairly certain
that both 16 ms frames and 44.1 kHz sample rate would fail the colored
lights test, with the text vectors considered today, even if we were
defining conformance very loosely.  In such a case, I don't think that you
can necessarily rely with any certainty on the IPR declarations provided.
Stephan

---

From: John Ridges <[email-masked]>
Date: Fri, 18 Nov 2011 15:44:54 -0700

Well, I'm not a lawyer, but it doesn't seem right that a standard should 
invite you to use the reference implementation in a way that would 
violate its own IPR declarations. It makes me wonder if there are ways 
of inadvertently misusing the codec's API that would do so as well.

John Ridges

On 11/18/2011 3:26 PM, Stephan Wenger wrote:
> On 11.19.2011 00:20 , "John Ridges"<[email-masked]>  wrote:
>

---

From: Gregory Maxwell <[email-masked]>
Date: Fri, 18 Nov 2011 14:41:26 -0800

>can necessarily rely with any certainty on the IPR declarations provided.

The conformance requirement is that the implementation can correctly
decode the test vectors as stated It doesn't require the codec to correctly
decode every conceivable sequence of bits.

The discussion here is not related to modified or incompatible versions of Opus, 
but about things specifically described in the draft.

Perhaps you'd like to reconsider your statement?

---

From: Ron <[email-masked]>
Date: Sat, 19 Nov 2011 09:37:58 +1030

> in your use of your own patents due to reciprocity conditions and whatnot.

Unarguably, that only affects the tiny minority of players who might
be planning on using their own patents for whatnot though.

So arguably, that might be called a Freedom.

99.9% reciprocally,

 Ron

---

From: Gregory Maxwell <[email-masked]>
Date: Fri, 18 Nov 2011 15:06:41 -0800

> of inadvertently misusing the codec's API that would do so as well.

Obviously.

This is the purpose of language like: [warning generic language from an IPR
statement is contained in the paragraph below]

"Specification means, [...]
(b) any reference implementation (each, a “Reference Implementation”)
published by the IETF Codec Working Group in the request for comments
[...]  . Licensed patents [...] in the case of (b) above, use of the
reference implementation to the extent it infringes such patent"

My expectation is that the red light / green-light stuff is moot if  you are
using an IETF published reference implementation as is. This is the
reasonable and expected thing, and to the best of my knowledge it was
the intention of the parties that contributed to the process.

Other things are permitted as well, subject to the conformance
requirements, but if you want to be extra paranoid, and want to take
the easy way out, using the reference itself will cover you.

If you've found some reason to believe otherwise, please contact me
and I'll either point you to whatever you're missing or fuss at people
to get it fixed.  (This is a generic invitation, open to any and all comers, 
if there is too much interest I'll write a FAQ outside of the working
group or something…)

---

From: John Ridges <[email-masked]>
Date: Fri, 18 Nov 2011 16:31:40 -0700

Mr. Maxwell,

I apologize for spreading any FUD. Your statement is what I had expected 
(and hoped for). I was thrown a bit by Mr. Wenger's concerns. For my 
part, I consider this matter closed.

John Ridges