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
c4dc6c4c
Commit
c4dc6c4c
authored
Feb 20, 2013
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bits_per_coded_sample when encoding png with frame-level multithreading.
Fixes ticket #2290.
parent
624fb5f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
pngenc.c
libavcodec/pngenc.c
+17
-5
No files found.
libavcodec/pngenc.c
View file @
c4dc6c4c
...
...
@@ -244,12 +244,10 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
color_type
=
PNG_COLOR_TYPE_RGB
;
break
;
case
AV_PIX_FMT_RGBA
:
avctx
->
bits_per_coded_sample
=
32
;
bit_depth
=
8
;
color_type
=
PNG_COLOR_TYPE_RGB_ALPHA
;
break
;
case
AV_PIX_FMT_RGB24
:
avctx
->
bits_per_coded_sample
=
24
;
bit_depth
=
8
;
color_type
=
PNG_COLOR_TYPE_RGB
;
break
;
...
...
@@ -258,7 +256,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
color_type
=
PNG_COLOR_TYPE_GRAY
;
break
;
case
AV_PIX_FMT_GRAY8
:
avctx
->
bits_per_coded_sample
=
0x28
;
bit_depth
=
8
;
color_type
=
PNG_COLOR_TYPE_GRAY
;
break
;
...
...
@@ -267,12 +264,10 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
color_type
=
PNG_COLOR_TYPE_GRAY_ALPHA
;
break
;
case
AV_PIX_FMT_MONOBLACK
:
avctx
->
bits_per_coded_sample
=
bit_depth
=
1
;
color_type
=
PNG_COLOR_TYPE_GRAY
;
break
;
case
AV_PIX_FMT_PAL8
:
avctx
->
bits_per_coded_sample
=
bit_depth
=
8
;
color_type
=
PNG_COLOR_TYPE_PALETTE
;
break
;
...
...
@@ -437,6 +432,23 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
static
av_cold
int
png_enc_init
(
AVCodecContext
*
avctx
){
PNGEncContext
*
s
=
avctx
->
priv_data
;
switch
(
avctx
->
pix_fmt
)
{
case
AV_PIX_FMT_RGBA
:
avctx
->
bits_per_coded_sample
=
32
;
break
;
case
AV_PIX_FMT_RGB24
:
avctx
->
bits_per_coded_sample
=
24
;
break
;
case
AV_PIX_FMT_GRAY8
:
avctx
->
bits_per_coded_sample
=
0x28
;
break
;
case
AV_PIX_FMT_MONOBLACK
:
avctx
->
bits_per_coded_sample
=
1
;
break
;
case
AV_PIX_FMT_PAL8
:
avctx
->
bits_per_coded_sample
=
8
;
}
avcodec_get_frame_defaults
(
&
s
->
picture
);
avctx
->
coded_frame
=
&
s
->
picture
;
ff_dsputil_init
(
&
s
->
dsp
,
avctx
);
...
...
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