Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
37702e20
Commit
37702e20
authored
Nov 11, 2023
by
Peter Ross
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/lead: support format 0x0
Fixes ticket #10660.
parent
db975ff0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
2 deletions
+43
-2
leaddec.c
libavcodec/leaddec.c
+43
-2
No files found.
libavcodec/leaddec.c
View file @
37702e20
...
...
@@ -142,7 +142,7 @@ static int lead_decode_frame(AVCodecContext *avctx, AVFrame * frame,
{
LeadContext
*
s
=
avctx
->
priv_data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
ret
,
format
,
yuv20p_half
=
0
,
fields
=
1
,
q
,
size
;
int
ret
,
format
,
zero
=
0
,
yuv20p_half
=
0
,
fields
=
1
,
q
,
size
;
GetBitContext
gb
;
int16_t
dc_pred
[
3
]
=
{
0
,
0
,
0
};
uint16_t
dequant
[
2
][
64
];
...
...
@@ -152,6 +152,10 @@ static int lead_decode_frame(AVCodecContext *avctx, AVFrame * frame,
format
=
AV_RL16
(
buf
+
4
);
switch
(
format
)
{
case
0x0
:
zero
=
1
;
avctx
->
pix_fmt
=
AV_PIX_FMT_YUV420P
;
break
;
case
0x8000
:
yuv20p_half
=
1
;
// fall-through
...
...
@@ -194,7 +198,44 @@ static int lead_decode_frame(AVCodecContext *avctx, AVFrame * frame,
init_get_bits8
(
&
gb
,
s
->
bitstream_buf
,
size
);
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_YUV420P
)
{
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_YUV420P
&&
zero
)
{
for
(
int
mb_y
=
0
;
mb_y
<
avctx
->
height
/
8
;
mb_y
++
)
for
(
int
mb_x
=
0
;
mb_x
<
avctx
->
width
/
16
;
mb_x
++
)
for
(
int
b
=
0
;
b
<
4
;
b
++
)
{
int
luma_block
=
2
;
const
VLCElem
*
dc_vlc
=
b
<
luma_block
?
luma_dc_vlc
:
chroma_dc_vlc
;
int
dc_bits
=
b
<
luma_block
?
LUMA_DC_BITS
:
CHROMA_DC_BITS
;
const
VLCElem
*
ac_vlc
=
b
<
luma_block
?
luma_ac_vlc
:
chroma_ac_vlc
;
int
ac_bits
=
b
<
luma_block
?
LUMA_AC_BITS
:
CHROMA_AC_BITS
;
int
plane
=
b
<
luma_block
?
0
:
b
-
1
;
int
x
,
y
,
yclip
;
if
(
b
<
luma_block
)
{
y
=
8
*
mb_y
+
8
*
(
b
>>
1
);
x
=
16
*
mb_x
+
8
*
(
b
&
1
);
yclip
=
0
;
}
else
{
y
=
4
*
mb_y
;
x
=
8
*
mb_x
;
yclip
=
y
+
8
>=
avctx
->
height
/
2
;
}
if
(
yclip
)
{
uint8_t
tmp
[
64
];
ret
=
decode_block
(
s
,
&
gb
,
dc_vlc
,
dc_bits
,
ac_vlc
,
ac_bits
,
dc_pred
+
plane
,
dequant
[
!
(
b
<
4
)],
tmp
,
8
);
for
(
int
yy
=
0
;
yy
<
8
&&
y
+
yy
<
avctx
->
height
/
2
;
yy
++
)
memcpy
(
frame
->
data
[
plane
]
+
(
y
+
yy
)
*
frame
->
linesize
[
plane
]
+
x
,
tmp
+
yy
,
8
);
}
else
{
ret
=
decode_block
(
s
,
&
gb
,
dc_vlc
,
dc_bits
,
ac_vlc
,
ac_bits
,
dc_pred
+
plane
,
dequant
[
!
(
b
<
4
)],
frame
->
data
[
plane
]
+
y
*
frame
->
linesize
[
plane
]
+
x
,
frame
->
linesize
[
plane
]);
}
if
(
ret
<
0
)
return
ret
;
}
}
else
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_YUV420P
)
{
for
(
int
mb_y
=
0
;
mb_y
<
(
avctx
->
height
+
15
)
/
16
;
mb_y
++
)
for
(
int
mb_x
=
0
;
mb_x
<
(
avctx
->
width
+
15
)
/
16
;
mb_x
++
)
for
(
int
b
=
0
;
b
<
(
yuv20p_half
?
4
:
6
);
b
++
)
{
...
...
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