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
9bc055e3
Commit
9bc055e3
authored
Sep 19, 2012
by
Alex Converse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tiffenc: Simplify pixel format setup using AVPixFmtDescriptor.
parent
5e3f9979
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
23 deletions
+17
-23
tiffenc.c
libavcodec/tiffenc.c
+17
-23
No files found.
libavcodec/tiffenc.c
View file @
9bc055e3
...
...
@@ -27,6 +27,7 @@
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "config.h"
...
...
@@ -219,6 +220,7 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
int
is_yuv
=
0
;
uint8_t
*
yuv_line
=
NULL
;
int
shift_h
,
shift_v
;
const
AVPixFmtDescriptor
*
pfd
;
s
->
avctx
=
avctx
;
...
...
@@ -232,41 +234,35 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
s
->
subsampling
[
0
]
=
1
;
s
->
subsampling
[
1
]
=
1
;
s
->
bpp_tab_size
=
0
;
switch
(
avctx
->
pix_fmt
)
{
case
PIX_FMT_RGB48LE
:
s
->
bpp
=
48
;
s
->
photometric_interpretation
=
2
;
s
->
bpp_tab_size
=
3
;
for
(
i
=
0
;
i
<
s
->
bpp_tab_size
;
i
++
)
{
bpp_tab
[
i
]
=
16
;
}
break
;
case
PIX_FMT_GRAY16LE
:
s
->
bpp
=
16
;
s
->
photometric_interpretation
=
1
;
s
->
bpp_tab_size
=
1
;
bpp_tab
[
0
]
=
16
;
break
;
case
PIX_FMT_RGB24
:
s
->
bpp
=
24
;
s
->
photometric_interpretation
=
2
;
break
;
case
PIX_FMT_GRAY8
:
s
->
bpp
=
8
;
s
->
photometric_interpretation
=
1
;
break
;
case
PIX_FMT_PAL8
:
s
->
bpp
=
8
;
s
->
photometric_interpretation
=
3
;
pfd
=
&
av_pix_fmt_descriptors
[
avctx
->
pix_fmt
];
s
->
bpp
=
av_get_bits_per_pixel
(
pfd
);
if
(
pfd
->
flags
&
PIX_FMT_PAL
)
{
s
->
photometric_interpretation
=
3
;
}
else
if
(
pfd
->
flags
&
PIX_FMT_RGB
)
{
s
->
photometric_interpretation
=
2
;
}
else
{
s
->
photometric_interpretation
=
1
;
}
s
->
bpp_tab_size
=
pfd
->
nb_components
;
for
(
i
=
0
;
i
<
s
->
bpp_tab_size
;
i
++
)
{
bpp_tab
[
i
]
=
s
->
bpp
/
s
->
bpp_tab_size
;
}
break
;
case
PIX_FMT_MONOBLACK
:
s
->
bpp
=
1
;
s
->
photometric_interpretation
=
1
;
s
->
bpp_tab_size
=
0
;
break
;
case
PIX_FMT_MONOWHITE
:
s
->
bpp
=
1
;
s
->
photometric_interpretation
=
0
;
s
->
bpp_tab_size
=
0
;
break
;
case
PIX_FMT_YUV420P
:
case
PIX_FMT_YUV422P
:
...
...
@@ -287,8 +283,6 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
"This colors format is not supported
\n
"
);
return
-
1
;
}
if
(
!
s
->
bpp_tab_size
)
s
->
bpp_tab_size
=
(
s
->
bpp
>>
3
);
if
(
s
->
compr
==
TIFF_DEFLATE
||
s
->
compr
==
TIFF_ADOBE_DEFLATE
||
s
->
compr
==
TIFF_LZW
)
//best choose for DEFLATE
...
...
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