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
4093d130
Commit
4093d130
authored
Jan 11, 2012
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support encoding RGB48 with libopenjpeg.
Reviewed-by: Michael Bradshaw
parent
5387f991
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
libopenjpegenc.c
libavcodec/libopenjpegenc.c
+35
-1
No files found.
libavcodec/libopenjpegenc.c
View file @
4093d130
...
@@ -77,6 +77,11 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p
...
@@ -77,6 +77,11 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p
color_space
=
CLRSPC_SRGB
;
color_space
=
CLRSPC_SRGB
;
numcomps
=
4
;
numcomps
=
4
;
break
;
break
;
case
PIX_FMT_RGB48
:
color_space
=
CLRSPC_SRGB
;
numcomps
=
3
;
bpp
=
16
;
break
;
case
PIX_FMT_YUV420P
:
case
PIX_FMT_YUV420P
:
color_space
=
CLRSPC_SYCC
;
color_space
=
CLRSPC_SYCC
;
numcomps
=
3
;
numcomps
=
3
;
...
@@ -207,6 +212,32 @@ static int libopenjpeg_copy_rgba(AVCodecContext *avctx, AVFrame *frame, opj_imag
...
@@ -207,6 +212,32 @@ static int libopenjpeg_copy_rgba(AVCodecContext *avctx, AVFrame *frame, opj_imag
return
1
;
return
1
;
}
}
static
int
libopenjpeg_copy_rgb16
(
AVCodecContext
*
avctx
,
AVFrame
*
frame
,
opj_image_t
*
image
,
int
numcomps
)
{
int
compno
;
int
x
;
int
y
;
uint16_t
*
frame_ptr
=
(
uint16_t
*
)
frame
->
data
[
0
];
av_assert0
(
numcomps
==
3
);
for
(
compno
=
0
;
compno
<
numcomps
;
++
compno
)
{
if
(
image
->
comps
[
compno
].
w
>
frame
->
linesize
[
0
]
/
numcomps
)
{
return
0
;
}
}
for
(
compno
=
0
;
compno
<
numcomps
;
++
compno
)
{
for
(
y
=
0
;
y
<
avctx
->
height
;
++
y
)
{
for
(
x
=
0
;
x
<
avctx
->
width
;
++
x
)
{
image
->
comps
[
compno
].
data
[
y
*
avctx
->
width
+
x
]
=
frame_ptr
[
y
*
frame
->
linesize
[
0
]
/
2
+
x
*
numcomps
+
compno
];
}
}
}
return
1
;
}
static
int
libopenjpeg_copy_yuv8
(
AVCodecContext
*
avctx
,
AVFrame
*
frame
,
opj_image_t
*
image
)
static
int
libopenjpeg_copy_yuv8
(
AVCodecContext
*
avctx
,
AVFrame
*
frame
,
opj_image_t
*
image
)
{
{
int
compno
;
int
compno
;
...
@@ -292,6 +323,9 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf
...
@@ -292,6 +323,9 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf
case
PIX_FMT_RGBA
:
case
PIX_FMT_RGBA
:
cpyresult
=
libopenjpeg_copy_rgba
(
avctx
,
frame
,
image
,
4
);
cpyresult
=
libopenjpeg_copy_rgba
(
avctx
,
frame
,
image
,
4
);
break
;
break
;
case
PIX_FMT_RGB48
:
cpyresult
=
libopenjpeg_copy_rgb16
(
avctx
,
frame
,
image
,
3
);
break
;
case
PIX_FMT_YUV420P
:
case
PIX_FMT_YUV420P
:
case
PIX_FMT_YUV422P
:
case
PIX_FMT_YUV422P
:
case
PIX_FMT_YUV440P
:
case
PIX_FMT_YUV440P
:
...
@@ -366,7 +400,7 @@ AVCodec ff_libopenjpeg_encoder = {
...
@@ -366,7 +400,7 @@ AVCodec ff_libopenjpeg_encoder = {
.
encode
=
libopenjpeg_encode_frame
,
.
encode
=
libopenjpeg_encode_frame
,
.
close
=
libopenjpeg_encode_close
,
.
close
=
libopenjpeg_encode_close
,
.
capabilities
=
0
,
.
capabilities
=
0
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_RGB24
,
PIX_FMT_RGBA
,
PIX_FMT_GRAY8
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_RGB24
,
PIX_FMT_RGBA
,
PIX_FMT_
RGB48
,
PIX_FMT_
GRAY8
,
PIX_FMT_YUV420P
,
PIX_FMT_YUV422P
,
PIX_FMT_YUVA420P
,
PIX_FMT_YUV420P
,
PIX_FMT_YUV422P
,
PIX_FMT_YUVA420P
,
PIX_FMT_YUV440P
,
PIX_FMT_YUV444P
,
PIX_FMT_YUV440P
,
PIX_FMT_YUV444P
,
PIX_FMT_YUV420P9
,
PIX_FMT_YUV422P9
,
PIX_FMT_YUV444P9
,
PIX_FMT_YUV420P9
,
PIX_FMT_YUV422P9
,
PIX_FMT_YUV444P9
,
...
...
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