[opus] One question about Opus encoder
Huang, Hao 1. (Nokia - CN/Hangzhou)
hao.1.huang at nokia.com
Wed Apr 1 19:47:41 PDT 2015
Hi, Opus team
I'm Huang Hao and trouble you again.
When I used the OpusRepacketizer as Jean-Marc mentioned, I got a result (maybe problem I'm not sure) that perplexes me, please give me some comments.
The result be described as below:
First(all init which are needed I have done), I used opus_encode() to get the encoded data successfully. The encoder control parameters are set: VBR=0, CVBR=0, INBAND_FEC=0, and mode is OPUS_AUTO(means I will use CBR), then I can get the individual frames in form of code0 or code3CBR(with padding part).
Then, I used opus_repacketizer_cat() to cat 3 of the individual frames(2 code3CBR frame and 1 code0 frame) to become a multiframe successfully.
Last, I used opus_repacketizer_out() to get the multiframe that I find the multiframe's toc+vpm indicates that the multiframe is a code3VBR format. Use a CBR encoder but got a VBR result, This is what perplexes me, and my question is is this normal?
And I read the opus lib source found that when call opus_repacketizer_out() and it will be into opus_repacketizer_out_range_impl() and finally into switch:default branch, the codes is below:
/* Code 3 */
vbr = 0;
if (len[i] != len)
I noted that in red part that the vbr flag is set just according to the length. But when use opus_repacketizer_cat() to cat the individual frame which is code3CBR that the padding part will be discard(code is below within red), then the length is not equal with the individual frame which is code0 or other code3CBR, and I think is this a fault?
default: /*case 3:*/
/* Number of frames encoded in bits 0 to 5 */
ch = *data++;
count = ch&0x3F;
if (count <= 0 || framesize*count > 5760)
/* Padding flag is bit 6 */
p = *data++;
len -= p==255 ? 254: p;
} while (p==255);
Very pleasure if you can reply, thanks very much.
From: Huang, Hao 1. (NSN - CN/Hangzhou)
Sent: Tuesday, November 12, 2013 4:21 PM
To: 'ext Jean-Marc Valin'
Subject: RE: One question about Opus encoder
Thanks very much!
From: ext Jean-Marc Valin [mailto:jmvalin at jmvalin.ca]
Sent: Tuesday, November 12, 2013 3:56 PM
To: Huang, Hao 1. (NSN - CN/Hangzhou)
Subject: Re: One question about Opus encoder
In almost all cases it will create a code 0 packet. You can then
concatenate packets using the OpusRepacketizer. Also, unless you have
confidential questions, please use the mailing list instead: opus at xiph.org<mailto:opus at xiph.org>
On 11/12/2013 02:41 AM, Huang, Hao 1. (NSN - CN/Hangzhou) wrote:
> Hi, jmvalin
> I'm Huang Hao From NSN company in China. Now I have a question about
> Opus encoder when I read the source code about opus. When we use
> opus_encode() success, it will create a opus packet , but this packet is
> always type of code 0 packet of opus, so I wonder that this function is
> only create code 0 packet? If so, how we can create other type
> packet(code 1, code 2, ....), writing own function codes? Very pleasure if
> you can reply, thanks very much.
> Huang Hao
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the opus