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
daffed3b
Commit
daffed3b
authored
Dec 02, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ljpegenc: accept bgr24 instead of bgra
The alpha plane is not encoded.
parent
0cdbc4d3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
ljpegenc.c
libavcodec/ljpegenc.c
+9
-9
mjpegenc.c
libavcodec/mjpegenc.c
+2
-2
No files found.
libavcodec/ljpegenc.c
View file @
daffed3b
...
@@ -70,8 +70,8 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -70,8 +70,8 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int
max_pkt_size
=
FF_MIN_BUFFER_SIZE
;
int
max_pkt_size
=
FF_MIN_BUFFER_SIZE
;
int
ret
,
header_bits
;
int
ret
,
header_bits
;
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_BGR
A
)
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_BGR
24
)
max_pkt_size
+=
width
*
height
*
3
*
4
;
max_pkt_size
+=
width
*
height
*
3
*
3
;
else
{
else
{
max_pkt_size
+=
mb_width
*
mb_height
*
3
*
4
max_pkt_size
+=
mb_width
*
mb_height
*
3
*
4
*
s
->
hsample
[
0
]
*
s
->
vsample
[
0
];
*
s
->
hsample
[
0
]
*
s
->
vsample
[
0
];
...
@@ -88,7 +88,7 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -88,7 +88,7 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
header_bits
=
put_bits_count
(
&
pb
);
header_bits
=
put_bits_count
(
&
pb
);
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_BGRA
)
{
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_BGR24
)
{
int
x
,
y
,
i
;
int
x
,
y
,
i
;
const
int
linesize
=
pict
->
linesize
[
0
];
const
int
linesize
=
pict
->
linesize
[
0
];
uint16_t
(
*
buffer
)[
4
]
=
s
->
scratch
;
uint16_t
(
*
buffer
)[
4
]
=
s
->
scratch
;
...
@@ -102,7 +102,7 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -102,7 +102,7 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const
int
modified_predictor
=
y
?
predictor
:
1
;
const
int
modified_predictor
=
y
?
predictor
:
1
;
uint8_t
*
ptr
=
pict
->
data
[
0
]
+
(
linesize
*
y
);
uint8_t
*
ptr
=
pict
->
data
[
0
]
+
(
linesize
*
y
);
if
(
pb
.
buf_end
-
pb
.
buf
-
(
put_bits_count
(
&
pb
)
>>
3
)
<
width
*
3
*
4
)
{
if
(
pb
.
buf_end
-
pb
.
buf
-
(
put_bits_count
(
&
pb
)
>>
3
)
<
width
*
3
*
3
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"encoded frame too large
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"encoded frame too large
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -111,9 +111,9 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -111,9 +111,9 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
top
[
i
]
=
left
[
i
]
=
topleft
[
i
]
=
buffer
[
0
][
i
];
top
[
i
]
=
left
[
i
]
=
topleft
[
i
]
=
buffer
[
0
][
i
];
}
}
for
(
x
=
0
;
x
<
width
;
x
++
)
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
buffer
[
x
][
1
]
=
ptr
[
4
*
x
+
0
]
-
ptr
[
4
*
x
+
1
]
+
0x100
;
buffer
[
x
][
1
]
=
ptr
[
3
*
x
+
0
]
-
ptr
[
3
*
x
+
1
]
+
0x100
;
buffer
[
x
][
2
]
=
ptr
[
4
*
x
+
2
]
-
ptr
[
4
*
x
+
1
]
+
0x100
;
buffer
[
x
][
2
]
=
ptr
[
3
*
x
+
2
]
-
ptr
[
3
*
x
+
1
]
+
0x100
;
buffer
[
x
][
0
]
=
(
ptr
[
4
*
x
+
0
]
+
2
*
ptr
[
4
*
x
+
1
]
+
ptr
[
4
*
x
+
2
])
>>
2
;
buffer
[
x
][
0
]
=
(
ptr
[
3
*
x
+
0
]
+
2
*
ptr
[
3
*
x
+
1
]
+
ptr
[
3
*
x
+
2
])
>>
2
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
int
pred
,
diff
;
int
pred
,
diff
;
...
@@ -257,7 +257,7 @@ static av_cold int ljpeg_encode_init(AVCodecContext *avctx)
...
@@ -257,7 +257,7 @@ static av_cold int ljpeg_encode_init(AVCodecContext *avctx)
av_pix_fmt_get_chroma_sub_sample
(
avctx
->
pix_fmt
,
&
chroma_h_shift
,
av_pix_fmt_get_chroma_sub_sample
(
avctx
->
pix_fmt
,
&
chroma_h_shift
,
&
chroma_v_shift
);
&
chroma_v_shift
);
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_BGR
A
)
{
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_BGR
24
)
{
s
->
vsample
[
0
]
=
s
->
hsample
[
0
]
=
s
->
vsample
[
0
]
=
s
->
hsample
[
0
]
=
s
->
vsample
[
1
]
=
s
->
hsample
[
1
]
=
s
->
vsample
[
1
]
=
s
->
hsample
[
1
]
=
s
->
vsample
[
2
]
=
s
->
hsample
[
2
]
=
1
;
s
->
vsample
[
2
]
=
s
->
hsample
[
2
]
=
1
;
...
@@ -294,7 +294,7 @@ AVCodec ff_ljpeg_encoder = {
...
@@ -294,7 +294,7 @@ AVCodec ff_ljpeg_encoder = {
.
pix_fmts
=
(
const
enum
AVPixelFormat
[]){
AV_PIX_FMT_YUVJ420P
,
.
pix_fmts
=
(
const
enum
AVPixelFormat
[]){
AV_PIX_FMT_YUVJ420P
,
AV_PIX_FMT_YUVJ422P
,
AV_PIX_FMT_YUVJ422P
,
AV_PIX_FMT_YUVJ444P
,
AV_PIX_FMT_YUVJ444P
,
AV_PIX_FMT_BGR
A
,
AV_PIX_FMT_BGR
24
,
AV_PIX_FMT_YUV420P
,
AV_PIX_FMT_YUV420P
,
AV_PIX_FMT_YUV422P
,
AV_PIX_FMT_YUV422P
,
AV_PIX_FMT_YUVJ444P
,
AV_PIX_FMT_YUVJ444P
,
...
...
libavcodec/mjpegenc.c
View file @
daffed3b
...
@@ -186,7 +186,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
...
@@ -186,7 +186,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
&
chroma_v_shift
);
&
chroma_v_shift
);
if
(
avctx
->
codec
->
id
==
AV_CODEC_ID_LJPEG
&&
if
(
avctx
->
codec
->
id
==
AV_CODEC_ID_LJPEG
&&
avctx
->
pix_fmt
==
AV_PIX_FMT_BGR
A
)
{
avctx
->
pix_fmt
==
AV_PIX_FMT_BGR
24
)
{
vsample
[
0
]
=
hsample
[
0
]
=
vsample
[
0
]
=
hsample
[
0
]
=
vsample
[
1
]
=
hsample
[
1
]
=
vsample
[
1
]
=
hsample
[
1
]
=
vsample
[
2
]
=
hsample
[
2
]
=
1
;
vsample
[
2
]
=
hsample
[
2
]
=
1
;
...
@@ -212,7 +212,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
...
@@ -212,7 +212,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
}
}
put_bits
(
pb
,
16
,
17
);
put_bits
(
pb
,
16
,
17
);
if
(
lossless
&&
avctx
->
pix_fmt
==
AV_PIX_FMT_BGR
A
)
if
(
lossless
&&
avctx
->
pix_fmt
==
AV_PIX_FMT_BGR
24
)
put_bits
(
pb
,
8
,
9
);
/* 9 bits/component RCT */
put_bits
(
pb
,
8
,
9
);
/* 9 bits/component RCT */
else
else
put_bits
(
pb
,
8
,
8
);
/* 8 bits/component */
put_bits
(
pb
,
8
,
8
);
/* 8 bits/component */
...
...
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