Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
e7d977b4
Commit
e7d977b4
authored
Jul 10, 2017
by
Rostislav Pehlivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opus_rc: fix encoder desyncs on very low bitrates
Signed-off-by:
Rostislav Pehlivanov
<
atomnuker@gmail.com
>
parent
8041b242
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
opus_rc.c
libavcodec/opus_rc.c
+10
-7
No files found.
libavcodec/opus_rc.c
View file @
e7d977b4
...
...
@@ -381,18 +381,21 @@ void ff_opus_rc_enc_end(OpusRangeCoder *rc, uint8_t *dst, int size)
opus_rc_enc_carryout
(
rc
,
0
);
rng_bytes
=
rc
->
rng_cur
-
rc
->
buf
;
rc
->
waste
=
(
size
-
(
rc
->
rb
.
bytes
+
rng_bytes
))
<<
3
;
memcpy
(
dst
,
rc
->
buf
,
rng_bytes
);
memset
(
dst
+
rng_bytes
,
0
,
FFMAX
(
rc
->
waste
>>
3
,
0
)
+
1
);
rc
->
waste
=
size
*
8
-
(
rc
->
rb
.
bytes
*
8
+
rc
->
rb
.
cachelen
)
-
rng_bytes
*
8
;
/* Put the rawbits part, if any */
if
(
rc
->
rb
.
bytes
||
rc
->
rb
.
cachelen
)
{
int
rawbytes
=
FFALIGN
(
rc
->
rb
.
bytes
*
8
+
rc
->
rb
.
cachelen
,
8
)
>>
3
;
int
dst_loc
=
FFMAX
(
size
-
rawbytes
,
0
);
uint8_t
*
src
=
rc
->
buf
+
OPUS_MAX_PACKET_SIZE
+
12
-
rawbytes
;
int
i
,
lap
;
uint8_t
*
rb_src
,
*
rb_dst
;
ff_opus_rc_put_raw
(
rc
,
0
,
32
-
rc
->
rb
.
cachelen
);
dst
[
dst_loc
]
|=
*
src
++
;
memcpy
(
&
dst
[
dst_loc
+
1
],
src
,
rawbytes
-
1
);
rb_src
=
rc
->
buf
+
OPUS_MAX_PACKET_SIZE
+
12
-
rc
->
rb
.
bytes
;
rb_dst
=
dst
+
FFMAX
(
size
-
rc
->
rb
.
bytes
,
0
);
lap
=
&
dst
[
rng_bytes
]
-
rb_dst
;
for
(
i
=
0
;
i
<
lap
;
i
++
)
rb_dst
[
i
]
|=
rb_src
[
i
];
memcpy
(
&
rb_dst
[
lap
],
&
rb_src
[
lap
],
FFMAX
(
rc
->
rb
.
bytes
-
lap
,
0
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment