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
c58c6739
Commit
c58c6739
authored
12 years ago
by
Michael Bradshaw
Browse files
Options
Downloads
Patches
Plain Diff
libopenjpegenc: add support for pix fmt gbrp (8-16 bit)
Signed-off-by:
Michael Bradshaw
<
mjbshaw@gmail.com
>
parent
402ea625
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/libopenjpegenc.c
+33
-0
33 additions, 0 deletions
libavcodec/libopenjpegenc.c
with
33 additions
and
0 deletions
libavcodec/libopenjpegenc.c
+
33
−
0
View file @
c58c6739
...
@@ -100,6 +100,12 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p
...
@@ -100,6 +100,12 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p
case
AV_PIX_FMT_RGBA
:
case
AV_PIX_FMT_RGBA
:
case
AV_PIX_FMT_RGB48
:
case
AV_PIX_FMT_RGB48
:
case
AV_PIX_FMT_RGBA64
:
case
AV_PIX_FMT_RGBA64
:
case
AV_PIX_FMT_GBR24P
:
case
AV_PIX_FMT_GBRP9
:
case
AV_PIX_FMT_GBRP10
:
case
AV_PIX_FMT_GBRP12
:
case
AV_PIX_FMT_GBRP14
:
case
AV_PIX_FMT_GBRP16
:
color_space
=
CLRSPC_SRGB
;
color_space
=
CLRSPC_SRGB
;
break
;
break
;
case
AV_PIX_FMT_YUV410P
:
case
AV_PIX_FMT_YUV410P
:
...
@@ -351,6 +357,7 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -351,6 +357,7 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
opj_cio_t
*
stream
;
opj_cio_t
*
stream
;
int
cpyresult
=
0
;
int
cpyresult
=
0
;
int
ret
,
len
;
int
ret
,
len
;
AVFrame
gbrframe
;
// x0, y0 is the top left corner of the image
// x0, y0 is the top left corner of the image
// x1, y1 is the width, height of the reference grid
// x1, y1 is the width, height of the reference grid
...
@@ -369,6 +376,30 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -369,6 +376,30 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
case
AV_PIX_FMT_RGBA64
:
case
AV_PIX_FMT_RGBA64
:
cpyresult
=
libopenjpeg_copy_packed16
(
avctx
,
frame
,
image
);
cpyresult
=
libopenjpeg_copy_packed16
(
avctx
,
frame
,
image
);
break
;
break
;
case
AV_PIX_FMT_GBR24P
:
gbrframe
=
*
frame
;
gbrframe
.
data
[
0
]
=
frame
->
data
[
2
];
// swap to be rgb
gbrframe
.
data
[
1
]
=
frame
->
data
[
0
];
gbrframe
.
data
[
2
]
=
frame
->
data
[
1
];
gbrframe
.
linesize
[
0
]
=
frame
->
linesize
[
2
];
gbrframe
.
linesize
[
1
]
=
frame
->
linesize
[
0
];
gbrframe
.
linesize
[
2
]
=
frame
->
linesize
[
1
];
cpyresult
=
libopenjpeg_copy_unpacked8
(
avctx
,
&
gbrframe
,
image
);
break
;
case
AV_PIX_FMT_GBRP9
:
case
AV_PIX_FMT_GBRP10
:
case
AV_PIX_FMT_GBRP12
:
case
AV_PIX_FMT_GBRP14
:
case
AV_PIX_FMT_GBRP16
:
gbrframe
=
*
frame
;
gbrframe
.
data
[
0
]
=
frame
->
data
[
2
];
// swap to be rgb
gbrframe
.
data
[
1
]
=
frame
->
data
[
0
];
gbrframe
.
data
[
2
]
=
frame
->
data
[
1
];
gbrframe
.
linesize
[
0
]
=
frame
->
linesize
[
2
];
gbrframe
.
linesize
[
1
]
=
frame
->
linesize
[
0
];
gbrframe
.
linesize
[
2
]
=
frame
->
linesize
[
1
];
cpyresult
=
libopenjpeg_copy_unpacked16
(
avctx
,
&
gbrframe
,
image
);
break
;
case
AV_PIX_FMT_GRAY8
:
case
AV_PIX_FMT_GRAY8
:
case
AV_PIX_FMT_YUV410P
:
case
AV_PIX_FMT_YUV410P
:
case
AV_PIX_FMT_YUV411P
:
case
AV_PIX_FMT_YUV411P
:
...
@@ -505,6 +536,8 @@ AVCodec ff_libopenjpeg_encoder = {
...
@@ -505,6 +536,8 @@ AVCodec ff_libopenjpeg_encoder = {
.
capabilities
=
0
,
.
capabilities
=
0
,
.
pix_fmts
=
(
const
enum
AVPixelFormat
[])
{
.
pix_fmts
=
(
const
enum
AVPixelFormat
[])
{
AV_PIX_FMT_RGB24
,
AV_PIX_FMT_RGBA
,
AV_PIX_FMT_RGB48
,
AV_PIX_FMT_RGBA64
,
AV_PIX_FMT_RGB24
,
AV_PIX_FMT_RGBA
,
AV_PIX_FMT_RGB48
,
AV_PIX_FMT_RGBA64
,
AV_PIX_FMT_GBR24P
,
AV_PIX_FMT_GBRP9
,
AV_PIX_FMT_GBRP10
,
AV_PIX_FMT_GBRP12
,
AV_PIX_FMT_GBRP14
,
AV_PIX_FMT_GBRP16
,
AV_PIX_FMT_GRAY8
,
AV_PIX_FMT_GRAY8A
,
AV_PIX_FMT_GRAY16
,
AV_PIX_FMT_GRAY8
,
AV_PIX_FMT_GRAY8A
,
AV_PIX_FMT_GRAY16
,
AV_PIX_FMT_YUV420P
,
AV_PIX_FMT_YUV422P
,
AV_PIX_FMT_YUVA420P
,
AV_PIX_FMT_YUV420P
,
AV_PIX_FMT_YUV422P
,
AV_PIX_FMT_YUVA420P
,
AV_PIX_FMT_YUV440P
,
AV_PIX_FMT_YUV444P
,
AV_PIX_FMT_YUVA422P
,
AV_PIX_FMT_YUV440P
,
AV_PIX_FMT_YUV444P
,
AV_PIX_FMT_YUVA422P
,
...
...
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