Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
6c916192
Commit
6c916192
authored
8 years ago
by
Alexandra Hájková
Committed by
Diego Biurrun
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
mimic: Convert to the new bitstream reader
parent
cdc6727c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/mimic.c
+12
-12
12 additions, 12 deletions
libavcodec/mimic.c
with
12 additions
and
12 deletions
libavcodec/mimic.c
+
12
−
12
View file @
6c916192
...
...
@@ -24,9 +24,9 @@
#include
<stdint.h>
#include
"avcodec.h"
#include
"bitstream.h"
#include
"blockdsp.h"
#include
"internal.h"
#include
"get_bits.h"
#include
"bytestream.h"
#include
"bswapdsp.h"
#include
"hpeldsp.h"
...
...
@@ -51,7 +51,7 @@ typedef struct MimicContext {
DECLARE_ALIGNED
(
16
,
int16_t
,
dct_block
)[
64
];
Get
BitContext
g
b
;
Bit
stream
Context
b
c
;
ScanTable
scantable
;
BlockDSPContext
bdsp
;
BswapDSPContext
bbdsp
;
...
...
@@ -232,14 +232,14 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)
ctx
->
bdsp
.
clear_block
(
block
);
block
[
0
]
=
get_
bits
(
&
ctx
->
g
b
,
8
)
<<
3
;
block
[
0
]
=
bits
tream_read
(
&
ctx
->
b
c
,
8
)
<<
3
;
for
(
pos
=
1
;
pos
<
num_coeffs
;
pos
++
)
{
uint32_t
vlc
,
num_bits
;
int
value
;
int
coeff
;
vlc
=
get
_vlc
2
(
&
ctx
->
g
b
,
ctx
->
vlc
.
table
,
ctx
->
vlc
.
bits
,
3
);
vlc
=
bitstream_read
_vlc
(
&
ctx
->
b
c
,
ctx
->
vlc
.
table
,
ctx
->
vlc
.
bits
,
3
);
if
(
!
vlc
)
/* end-of-block code */
return
0
;
if
(
vlc
==
-
1
)
...
...
@@ -252,7 +252,7 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)
if
(
pos
>=
64
)
return
AVERROR_INVALIDDATA
;
value
=
get_
bits
(
&
ctx
->
g
b
,
num_bits
);
value
=
bits
tream_read
(
&
ctx
->
b
c
,
num_bits
);
/* Libav's IDCT behaves somewhat different from the original code, so
* a factor of 4 was added to the input */
...
...
@@ -286,13 +286,13 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs,
for
(
x
=
0
;
x
<
ctx
->
num_hblocks
[
plane
];
x
++
)
{
/* Check for a change condition in the current block.
* - iframes always change.
* - Luma plane changes on
get
_bit
s1
== 0
* - Chroma planes change on
get
_bit
s1
== 1 */
if
(
is_iframe
||
get
_bit
s1
(
&
ctx
->
g
b
)
==
is_chroma
)
{
* - Luma plane changes on
bitstream_read
_bit == 0
* - Chroma planes change on
bitstream_read
_bit == 1 */
if
(
is_iframe
||
bitstream_read
_bit
(
&
ctx
->
b
c
)
==
is_chroma
)
{
/* Luma planes may use a backreference from the 15 last
* frames preceding the previous. (
get
_bit
s1
== 1)
* frames preceding the previous. (
bitstream_read
_bit == 1)
* Chroma planes don't use backreferences. */
if
(
is_chroma
||
is_iframe
||
!
get
_bit
s1
(
&
ctx
->
g
b
))
{
if
(
is_chroma
||
is_iframe
||
!
bitstream_read
_bit
(
&
ctx
->
b
c
))
{
if
((
ret
=
vlc_decode_block
(
ctx
,
num_coeffs
,
qscale
))
<
0
)
{
av_log
(
ctx
->
avctx
,
AV_LOG_ERROR
,
"Error decoding "
...
...
@@ -301,7 +301,7 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs,
}
ctx
->
idsp
.
idct_put
(
dst
,
stride
,
ctx
->
dct_block
);
}
else
{
unsigned
int
backref
=
get_
bits
(
&
ctx
->
g
b
,
4
);
unsigned
int
backref
=
bits
tream_read
(
&
ctx
->
b
c
,
4
);
int
index
=
(
ctx
->
cur_index
+
backref
)
&
15
;
uint8_t
*
p
=
ctx
->
frames
[
index
].
f
->
data
[
0
];
...
...
@@ -426,7 +426,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
ctx
->
bbdsp
.
bswap_buf
(
ctx
->
swap_buf
,
(
const
uint32_t
*
)
(
buf
+
MIMIC_HEADER_SIZE
),
swap_buf_size
>>
2
);
init_get_b
it
s
(
&
ctx
->
g
b
,
ctx
->
swap_buf
,
swap_buf_size
<<
3
);
bitstream_in
it
(
&
ctx
->
b
c
,
ctx
->
swap_buf
,
swap_buf_size
<<
3
);
res
=
decode
(
ctx
,
quality
,
num_coeffs
,
!
is_pframe
);
ff_thread_report_progress
(
&
ctx
->
frames
[
ctx
->
cur_index
],
INT_MAX
,
0
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment