Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
d0ce0634
Commit
d0ce0634
authored
Apr 14, 2017
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clearvideo: Convert to the new bitstream reader
parent
189157c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
clearvideo.c
libavcodec/clearvideo.c
+12
-12
No files found.
libavcodec/clearvideo.c
View file @
d0ce0634
...
...
@@ -25,8 +25,8 @@
*/
#include "avcodec.h"
#include "bitstream.h"
#include "bytestream.h"
#include "get_bits.h"
#include "idctdsp.h"
#include "internal.h"
...
...
@@ -123,7 +123,7 @@ typedef struct CLVContext {
AVCodecContext
*
avctx
;
IDCTDSPContext
idsp
;
AVFrame
*
pic
;
GetBitContext
gb
;
BitstreamContext
bc
;
int
mb_width
,
mb_height
;
VLC
dc_vlc
,
ac_vlc
;
int
luma_dc_quant
,
chroma_dc_quant
,
ac_quant
;
...
...
@@ -135,11 +135,11 @@ typedef struct CLVContext {
static
inline
int
decode_block
(
CLVContext
*
ctx
,
int16_t
*
blk
,
int
has_ac
,
int
ac_quant
)
{
GetBitContext
*
gb
=
&
ctx
->
gb
;
BitstreamContext
*
bc
=
&
ctx
->
bc
;
int
idx
=
1
,
last
=
0
,
val
,
skip
;
memset
(
blk
,
0
,
sizeof
(
*
blk
)
*
64
);
blk
[
0
]
=
get_vlc2
(
gb
,
ctx
->
dc_vlc
.
table
,
9
,
3
);
blk
[
0
]
=
bitstream_read_vlc
(
bc
,
ctx
->
dc_vlc
.
table
,
9
,
3
);
if
(
blk
[
0
]
<
0
)
return
AVERROR_INVALIDDATA
;
blk
[
0
]
-=
63
;
...
...
@@ -148,19 +148,19 @@ static inline int decode_block(CLVContext *ctx, int16_t *blk, int has_ac,
return
0
;
while
(
idx
<
64
&&
!
last
)
{
val
=
get_vlc2
(
gb
,
ctx
->
ac_vlc
.
table
,
9
,
2
);
val
=
bitstream_read_vlc
(
bc
,
ctx
->
ac_vlc
.
table
,
9
,
2
);
if
(
val
<
0
)
return
AVERROR_INVALIDDATA
;
if
(
val
!=
0x1BFF
)
{
last
=
val
>>
12
;
skip
=
(
val
>>
4
)
&
0xFF
;
val
&=
0xF
;
if
(
get_bits1
(
gb
))
if
(
bitstream_read_bit
(
bc
))
val
=
-
val
;
}
else
{
last
=
get_bits1
(
gb
);
skip
=
get_bits
(
gb
,
6
);
val
=
get_sbits
(
gb
,
8
);
last
=
bitstream_read_bit
(
bc
);
skip
=
bitstream_read
(
bc
,
6
);
val
=
bitstream_read_signed
(
bc
,
8
);
}
if
(
val
)
{
int
aval
=
FFABS
(
val
),
sign
=
val
<
0
;
...
...
@@ -229,7 +229,7 @@ static int decode_mb(CLVContext *c, int x, int y)
int
i
,
has_ac
[
6
],
off
;
for
(
i
=
0
;
i
<
6
;
i
++
)
has_ac
[
i
]
=
get_bits1
(
&
c
->
gb
);
has_ac
[
i
]
=
bitstream_read_bit
(
&
c
->
bc
);
off
=
x
*
16
+
y
*
16
*
c
->
pic
->
linesize
[
0
];
for
(
i
=
0
;
i
<
4
;
i
++
)
{
...
...
@@ -301,8 +301,8 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data,
c
->
luma_dc_quant
=
32
;
c
->
chroma_dc_quant
=
32
;
if
((
ret
=
init_get_bits8
(
&
c
->
gb
,
buf
+
bytestream2_tell
(
&
gb
),
buf_size
-
bytestream2_tell
(
&
gb
)))
<
0
)
if
((
ret
=
bitstream_init8
(
&
c
->
bc
,
buf
+
bytestream2_tell
(
&
gb
),
buf_size
-
bytestream2_tell
(
&
gb
)))
<
0
)
return
ret
;
for
(
i
=
0
;
i
<
3
;
i
++
)
...
...
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