Subject: [codec] Comment on Opus Draft 07: Section 4 Range decoder

From: "Christian Hoene" <[email-masked]>
Date: Wed, 27 Jul 2011 11:14:22 -0400

Hi,

some editorial comments to the opus draft version 7, Section 4.1 to 4.1.2

Section 4.1
========
1) You might want to move Figure 8 to this section or - even better - add a
small new figure showing range encoded bits and raw bits at the beginning
and the ending of a frame.

2) The sentence  "Let f[i] be the frequency of the _i_th symbol in a context
with _n_ symbols total." is not complete. Instead I would write "Let f[i] be
the frequency of the _i_th symbol. There are _n_ symbols in total and index
_i_ ranges from 0 to n-1."

3) I am not sure about the rules of using "_something_". Maybe, it would
make sense to use the notion for _variable_, only, if at all.

4) Also, fl should be renamed to fl[k] and fh to fh[k] to make things more
clear. This also implies a couple of changes in the following sections.

5) I would change "It then immediately normalized ..." into "The remaning
bit is used in Renormalization (Section 4.1.1.1) function, which is
immediately calld to reads further bits from the input so that rng become
than rng > 2**23.".  Otherwise, one cannot understand (if reading only
serial) the equations in 4.1.1.

Section 4.1.1
==========
1) In this paragraph, "The decoder ... identified symbol" one can introduce
the index k to denote the index of the identified symbol.

2) I have a question in respect of the "rng" variable for k=0: Why do you
use (ft-fh) instead of fh in the equation "rng = rng - (rng/ft)*(ft-fh)". 
Because of the reason given in the following paragraph? "With this
formulation, all the truncation..." Adding a sentence here would make things
more clearer. 

3) Also, you might move "After the updates... identified symbols" to the end
of this section 4.1.1. 

4) Page 19: "log"? Do you mean logarithm dualis?

Section 4.1.1.1
============
1) " Then it reads the next 8 bits of  
   input into sym, using the remaining bit from the previous input octet
   as the high bit of sym, and the top 7 bits of the next octet as the
   remaining bits of sym."

This sentence is unclear. Which bits are read where? I would suggest to
change it to

" Then it reads in to total 8 bits from the input stream into the variable
sym. Bit 2**7 is taken from the previous input octet has a remaining bit
(refer e.g. to the initialization of the 
   as the high bit of sym, and the top 7 bits of the next octet as the
   remaining bits of sym."

2) I know, it does not make a difference in C. However, not everybody can
remember the priority of operators all the time. Thus, I would suggest to
change it to
"((val<<8)+(255-sym))&0x7FFFFFFF." (Page 19)

3) Before "It is normal and expected that the range decoder will read
several
   bytes into the raw bits data (if any) at the end of the packet by the
   time the frame is completely decoded, as illustrated in Figure 8."
A section header is missing like "4.1.2 Reading the last bits". I also would
explain it better. For example 
"The Renormalization is reading continually bits from the frame until the
last octet of the frame has been processed. After that, the range decoder
still might need further bits to continue the decoding of the last symbols".
These bits MUST be set to zero."
(Technical question: Are you really using these zero bits for compression?
So to say, are you truncating the frame if the last symbols have an index
k=0? Otherwise, there is no need for to demand zero with MUST).
Cont. "If the last bit of the frame use for getting raw data (see new Figure
in Section4.1), then the range decoder will process them for decoding its
symbols." 

Section 4.1.2
==========
I am not happy with Section 4.1.2. First, you cannot understand the text
without looking up the source code (= decompressing it in your memory).
Also the functions are only optimizations and are not needed to understand
the range decoder algorithm. I would suggest to move Section 4.1.2 entirely
into the source comment making it a description of the function
(alternative, you may move them to an appendix).

======

Enough for now. I need a coffee.

Dear authors, 

just a request: If you are considering my input and if you are change the
draft, please send me brief feedback on which changes are included and why
the other are not considered. Thanks

With best regards,

 Christian Hoene

----------------------------------------------------------------------------
-----
Dr.-Ing. Christian Hoene, University of Tübingen, Computer Science, Chair of
Communication Networks, Research Group Interactive Communication Systems
(ICS)
Sand 13, 72076 Tübingen, Germany, Tel +49 7071 2970532,
www.net.uni-tuebingen.de

---

From: "Timothy B. Terriberry" <[email-masked]>
Date: Thu, 28 Jul 2011 14:34:01 -0700

> [snip]

Just a quick note: I appreciate the editorial comments and will address 
them shortly, but I haven't had a chance to yet. Once I've merged my 
local copy of the draft with Jean-Marc's, I'll go over them in more 
detail and let you (and the list) know.