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
7b966af9
Commit
7b966af9
authored
Mar 07, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/imm4: fix artifacts on some files with special coding mode
parent
53248acf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
21 deletions
+22
-21
imm4.c
libavcodec/imm4.c
+22
-21
No files found.
libavcodec/imm4.c
View file @
7b966af9
...
...
@@ -138,7 +138,7 @@ static int get_cbphi(GetBitContext *gb, int x)
}
static
int
decode_block
(
AVCodecContext
*
avctx
,
GetBitContext
*
gb
,
int
block
,
int
factor
,
int
flag
,
int
offset
)
int
block
,
int
factor
,
int
flag
,
int
offset
,
int
flag2
)
{
IMM4Context
*
s
=
avctx
->
priv_data
;
const
uint8_t
*
scantable
=
s
->
intra_scantable
.
permutated
;
...
...
@@ -169,11 +169,19 @@ static int decode_block(AVCodecContext *avctx, GetBitContext *gb,
break
;
}
if
(
s
->
hi
==
2
&&
flag2
&&
block
<
4
)
{
if
(
flag
)
s
->
block
[
block
][
scantable
[
0
]]
*=
2
;
s
->
block
[
block
][
scantable
[
1
]]
*=
2
;
s
->
block
[
block
][
scantable
[
8
]]
*=
2
;
s
->
block
[
block
][
scantable
[
16
]]
*=
2
;
}
return
0
;
}
static
int
decode_blocks
(
AVCodecContext
*
avctx
,
GetBitContext
*
gb
,
unsigned
cbp
,
int
flag
,
int
offset
)
unsigned
cbp
,
int
flag
,
int
offset
,
unsigned
flag2
)
{
IMM4Context
*
s
=
avctx
->
priv_data
;
const
uint8_t
*
scantable
=
s
->
intra_scantable
.
permutated
;
...
...
@@ -193,7 +201,7 @@ static int decode_blocks(AVCodecContext *avctx, GetBitContext *gb,
}
if
(
cbp
&
(
1
<<
(
5
-
i
)))
{
ret
=
decode_block
(
avctx
,
gb
,
i
,
s
->
factor
,
flag
,
offset
);
ret
=
decode_block
(
avctx
,
gb
,
i
,
s
->
factor
,
flag
,
offset
,
flag2
);
if
(
ret
<
0
)
return
ret
;
}
...
...
@@ -212,11 +220,7 @@ static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame
return
AVERROR_INVALIDDATA
;
s
->
factor
=
intra_cb
[
s
->
lo
];
}
else
{
if
(
s
->
hi
==
1
)
{
s
->
factor
=
s
->
lo
*
2
;
}
else
{
s
->
factor
=
s
->
lo
*
2
;
}
s
->
factor
=
s
->
lo
*
2
;
}
if
(
s
->
hi
)
{
...
...
@@ -228,14 +232,14 @@ static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame
for
(
y
=
0
;
y
<
avctx
->
height
;
y
+=
16
)
{
for
(
x
=
0
;
x
<
avctx
->
width
;
x
+=
16
)
{
unsigned
cbphi
,
cbplo
;
unsigned
flag
,
cbphi
,
cbplo
;
cbplo
=
get_vlc2
(
gb
,
cbplo_tab
.
table
,
cbplo_tab
.
bits
,
1
)
>>
4
;
skip
_bits1
(
gb
);
flag
=
get
_bits1
(
gb
);
cbphi
=
get_cbphi
(
gb
,
1
);
ret
=
decode_blocks
(
avctx
,
gb
,
cbplo
|
(
cbphi
<<
2
),
0
,
offset
);
ret
=
decode_blocks
(
avctx
,
gb
,
cbplo
|
(
cbphi
<<
2
),
0
,
offset
,
flag
);
if
(
ret
<
0
)
return
ret
;
...
...
@@ -268,11 +272,7 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb,
return
AVERROR_INVALIDDATA
;
s
->
factor
=
inter_cb
[
s
->
lo
];
}
else
{
if
(
s
->
hi
==
1
)
{
s
->
factor
=
s
->
lo
*
2
;
}
else
{
s
->
factor
=
s
->
lo
*
2
;
}
s
->
factor
=
s
->
lo
*
2
;
}
if
(
s
->
hi
)
{
...
...
@@ -285,7 +285,7 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb,
for
(
y
=
0
;
y
<
avctx
->
height
;
y
+=
16
)
{
for
(
x
=
0
;
x
<
avctx
->
width
;
x
+=
16
)
{
int
reverse
,
intra_block
,
value
;
unsigned
cbphi
,
cbplo
;
unsigned
cbphi
,
cbplo
,
flag2
=
0
;
if
(
get_bits1
(
gb
))
{
copy_block16
(
frame
->
data
[
0
]
+
y
*
frame
->
linesize
[
0
]
+
x
,
...
...
@@ -307,12 +307,12 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb,
intra_block
=
value
&
0x07
;
reverse
=
intra_block
==
3
;
if
(
reverse
)
skip
_bits1
(
gb
);
flag2
=
get
_bits1
(
gb
);
cbplo
=
value
>>
4
;
cbphi
=
get_cbphi
(
gb
,
reverse
);
if
(
intra_block
)
{
ret
=
decode_blocks
(
avctx
,
gb
,
cbplo
|
(
cbphi
<<
2
),
0
,
offset
);
ret
=
decode_blocks
(
avctx
,
gb
,
cbplo
|
(
cbphi
<<
2
),
0
,
offset
,
flag2
);
if
(
ret
<
0
)
return
ret
;
...
...
@@ -329,8 +329,9 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb,
s
->
idsp
.
idct_put
(
frame
->
data
[
2
]
+
(
y
>>
1
)
*
frame
->
linesize
[
2
]
+
(
x
>>
1
),
frame
->
linesize
[
2
],
s
->
block
[
5
]);
}
else
{
skip_bits
(
gb
,
2
);
ret
=
decode_blocks
(
avctx
,
gb
,
cbplo
|
(
cbphi
<<
2
),
1
,
offset
);
flag2
=
get_bits1
(
gb
);
skip_bits1
(
gb
);
ret
=
decode_blocks
(
avctx
,
gb
,
cbplo
|
(
cbphi
<<
2
),
1
,
offset
,
flag2
);
if
(
ret
<
0
)
return
ret
;
...
...
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