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
52719dae
Commit
52719dae
authored
Feb 09, 2012
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support encoding BGR24 and BGR0 in ljpeg.
parent
edf34c34
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
ljpegenc.c
libavcodec/ljpegenc.c
+9
-1
mjpegenc.c
libavcodec/mjpegenc.c
+3
-1
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+6
-1
No files found.
libavcodec/ljpegenc.c
View file @
52719dae
...
...
@@ -56,7 +56,9 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
s
->
header_bits
=
put_bits_count
(
&
s
->
pb
);
if
(
avctx
->
pix_fmt
==
PIX_FMT_BGRA
){
if
(
avctx
->
pix_fmt
==
PIX_FMT_BGR0
||
avctx
->
pix_fmt
==
PIX_FMT_BGRA
||
avctx
->
pix_fmt
==
PIX_FMT_BGR24
){
int
x
,
y
,
i
;
const
int
linesize
=
p
->
linesize
[
0
];
uint16_t
(
*
buffer
)[
4
]
=
(
void
*
)
s
->
rd_scratchpad
;
...
...
@@ -79,9 +81,15 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
top
[
i
]
=
left
[
i
]
=
topleft
[
i
]
=
buffer
[
0
][
i
];
}
for
(
x
=
0
;
x
<
width
;
x
++
)
{
if
(
avctx
->
pix_fmt
==
PIX_FMT_BGR24
){
buffer
[
x
][
1
]
=
ptr
[
3
*
x
+
0
]
-
ptr
[
3
*
x
+
1
]
+
0x100
;
buffer
[
x
][
2
]
=
ptr
[
3
*
x
+
2
]
-
ptr
[
3
*
x
+
1
]
+
0x100
;
buffer
[
x
][
0
]
=
(
ptr
[
3
*
x
+
0
]
+
2
*
ptr
[
3
*
x
+
1
]
+
ptr
[
3
*
x
+
2
])
>>
2
;
}
else
{
buffer
[
x
][
1
]
=
ptr
[
4
*
x
+
0
]
-
ptr
[
4
*
x
+
1
]
+
0x100
;
buffer
[
x
][
2
]
=
ptr
[
4
*
x
+
2
]
-
ptr
[
4
*
x
+
1
]
+
0x100
;
buffer
[
x
][
0
]
=
(
ptr
[
4
*
x
+
0
]
+
2
*
ptr
[
4
*
x
+
1
]
+
ptr
[
4
*
x
+
2
])
>>
2
;
}
for
(
i
=
0
;
i
<
3
;
i
++
)
{
int
pred
,
diff
;
...
...
libavcodec/mjpegenc.c
View file @
52719dae
...
...
@@ -214,7 +214,9 @@ void ff_mjpeg_encode_picture_header(MpegEncContext *s)
}
put_bits
(
&
s
->
pb
,
16
,
17
);
if
(
lossless
&&
s
->
avctx
->
pix_fmt
==
PIX_FMT_BGRA
)
if
(
lossless
&&
(
s
->
avctx
->
pix_fmt
==
PIX_FMT_BGR0
||
s
->
avctx
->
pix_fmt
==
PIX_FMT_BGRA
||
s
->
avctx
->
pix_fmt
==
PIX_FMT_BGR24
))
put_bits
(
&
s
->
pb
,
8
,
9
);
/* 9 bits/component RCT */
else
put_bits
(
&
s
->
pb
,
8
,
8
);
/* 8 bits/component */
...
...
libavcodec/mpegvideo_enc.c
View file @
52719dae
...
...
@@ -295,7 +295,9 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
if
(
avctx
->
pix_fmt
!=
PIX_FMT_YUVJ420P
&&
avctx
->
pix_fmt
!=
PIX_FMT_YUVJ422P
&&
avctx
->
pix_fmt
!=
PIX_FMT_YUVJ444P
&&
avctx
->
pix_fmt
!=
PIX_FMT_BGR0
&&
avctx
->
pix_fmt
!=
PIX_FMT_BGRA
&&
avctx
->
pix_fmt
!=
PIX_FMT_BGR24
&&
((
avctx
->
pix_fmt
!=
PIX_FMT_YUV420P
&&
avctx
->
pix_fmt
!=
PIX_FMT_YUV422P
&&
avctx
->
pix_fmt
!=
PIX_FMT_YUV444P
)
||
...
...
@@ -625,7 +627,10 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
case
CODEC_ID_AMV
:
s
->
out_format
=
FMT_MJPEG
;
s
->
intra_only
=
1
;
/* force intra only for jpeg */
if
(
avctx
->
codec
->
id
==
CODEC_ID_LJPEG
&&
avctx
->
pix_fmt
==
PIX_FMT_BGRA
)
{
if
(
avctx
->
codec
->
id
==
CODEC_ID_LJPEG
&&
(
avctx
->
pix_fmt
==
PIX_FMT_BGR0
||
s
->
avctx
->
pix_fmt
==
PIX_FMT_BGRA
||
s
->
avctx
->
pix_fmt
==
PIX_FMT_BGR24
))
{
s
->
mjpeg_vsample
[
0
]
=
s
->
mjpeg_hsample
[
0
]
=
s
->
mjpeg_vsample
[
1
]
=
s
->
mjpeg_hsample
[
1
]
=
s
->
mjpeg_vsample
[
2
]
=
s
->
mjpeg_hsample
[
2
]
=
1
;
...
...
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