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
e209a377
Commit
e209a377
authored
13 years ago
by
Carl Eugen Hoyos
Browse files
Options
Downloads
Patches
Plain Diff
Simplify 32bit png decoding.
parent
21a10061
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavcodec/pngdec.c
+6
-16
6 additions, 16 deletions
libavcodec/pngdec.c
libavcodec/version.h
+1
-1
1 addition, 1 deletion
libavcodec/version.h
with
7 additions
and
17 deletions
libavcodec/pngdec.c
+
6
−
16
View file @
e209a377
...
@@ -101,17 +101,6 @@ static void png_put_interlaced_row(uint8_t *dst, int width,
...
@@ -101,17 +101,6 @@ static void png_put_interlaced_row(uint8_t *dst, int width,
bpp
=
bits_per_pixel
>>
3
;
bpp
=
bits_per_pixel
>>
3
;
d
=
dst
;
d
=
dst
;
s
=
src
;
s
=
src
;
if
(
color_type
==
PNG_COLOR_TYPE_RGB_ALPHA
)
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
j
=
x
&
7
;
if
((
dsp_mask
<<
j
)
&
0x80
)
{
*
(
uint32_t
*
)
d
=
(
s
[
3
]
<<
24
)
|
(
s
[
0
]
<<
16
)
|
(
s
[
1
]
<<
8
)
|
s
[
2
];
}
d
+=
bpp
;
if
((
mask
<<
j
)
&
0x80
)
s
+=
bpp
;
}
}
else
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
j
=
x
&
7
;
j
=
x
&
7
;
if
((
dsp_mask
<<
j
)
&
0x80
)
{
if
((
dsp_mask
<<
j
)
&
0x80
)
{
...
@@ -121,7 +110,6 @@ static void png_put_interlaced_row(uint8_t *dst, int width,
...
@@ -121,7 +110,6 @@ static void png_put_interlaced_row(uint8_t *dst, int width,
if
((
mask
<<
j
)
&
0x80
)
if
((
mask
<<
j
)
&
0x80
)
s
+=
bpp
;
s
+=
bpp
;
}
}
}
break
;
break
;
}
}
}
}
...
@@ -265,7 +253,10 @@ static av_always_inline void convert_to_rgb32_loco(uint8_t *dst, const uint8_t *
...
@@ -265,7 +253,10 @@ static av_always_inline void convert_to_rgb32_loco(uint8_t *dst, const uint8_t *
r
=
(
r
+
g
)
&
0xff
;
r
=
(
r
+
g
)
&
0xff
;
b
=
(
b
+
g
)
&
0xff
;
b
=
(
b
+
g
)
&
0xff
;
}
}
*
(
uint32_t
*
)
dst
=
(
a
<<
24
)
|
(
r
<<
16
)
|
(
g
<<
8
)
|
b
;
dst
[
0
]
=
r
;
dst
[
1
]
=
g
;
dst
[
2
]
=
b
;
dst
[
3
]
=
a
;
dst
+=
4
;
dst
+=
4
;
src
+=
4
;
src
+=
4
;
}
}
...
@@ -276,7 +267,7 @@ static void convert_to_rgb32(uint8_t *dst, const uint8_t *src, int width, int lo
...
@@ -276,7 +267,7 @@ static void convert_to_rgb32(uint8_t *dst, const uint8_t *src, int width, int lo
if
(
loco
)
if
(
loco
)
convert_to_rgb32_loco
(
dst
,
src
,
width
,
1
);
convert_to_rgb32_loco
(
dst
,
src
,
width
,
1
);
else
else
convert_to_rgb32_loco
(
dst
,
src
,
width
,
0
);
memcpy
(
dst
,
src
,
width
*
4
);
}
}
static
void
deloco_rgb24
(
uint8_t
*
dst
,
int
size
)
static
void
deloco_rgb24
(
uint8_t
*
dst
,
int
size
)
...
@@ -339,7 +330,6 @@ static void png_handle_row(PNGDecContext *s)
...
@@ -339,7 +330,6 @@ static void png_handle_row(PNGDecContext *s)
got_line
=
1
;
got_line
=
1
;
}
}
if
((
png_pass_dsp_ymask
[
s
->
pass
]
<<
(
s
->
y
&
7
))
&
0x80
)
{
if
((
png_pass_dsp_ymask
[
s
->
pass
]
<<
(
s
->
y
&
7
))
&
0x80
)
{
/* NOTE: RGB32 is handled directly in png_put_interlaced_row */
png_put_interlaced_row
(
ptr
,
s
->
width
,
s
->
bits_per_pixel
,
s
->
pass
,
png_put_interlaced_row
(
ptr
,
s
->
width
,
s
->
bits_per_pixel
,
s
->
pass
,
s
->
color_type
,
s
->
last_row
);
s
->
color_type
,
s
->
last_row
);
}
}
...
@@ -484,7 +474,7 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -484,7 +474,7 @@ static int decode_frame(AVCodecContext *avctx,
avctx
->
pix_fmt
=
PIX_FMT_RGB24
;
avctx
->
pix_fmt
=
PIX_FMT_RGB24
;
}
else
if
(
s
->
bit_depth
==
8
&&
}
else
if
(
s
->
bit_depth
==
8
&&
s
->
color_type
==
PNG_COLOR_TYPE_RGB_ALPHA
)
{
s
->
color_type
==
PNG_COLOR_TYPE_RGB_ALPHA
)
{
avctx
->
pix_fmt
=
PIX_FMT_RGB
32
;
avctx
->
pix_fmt
=
PIX_FMT_RGB
A
;
}
else
if
(
s
->
bit_depth
==
8
&&
}
else
if
(
s
->
bit_depth
==
8
&&
s
->
color_type
==
PNG_COLOR_TYPE_GRAY
)
{
s
->
color_type
==
PNG_COLOR_TYPE_GRAY
)
{
avctx
->
pix_fmt
=
PIX_FMT_GRAY8
;
avctx
->
pix_fmt
=
PIX_FMT_GRAY8
;
...
...
This diff is collapsed.
Click to expand it.
libavcodec/version.h
+
1
−
1
View file @
e209a377
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
#define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 57
#define LIBAVCODEC_VERSION_MINOR 57
#define LIBAVCODEC_VERSION_MICRO 10
3
#define LIBAVCODEC_VERSION_MICRO 10
4
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
LIBAVCODEC_VERSION_MINOR, \
...
...
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