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
6d9c27dc
Commit
6d9c27dc
authored
Feb 22, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jpeglsenc: switch to encode2().
parent
148fc995
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
jpeglsenc.c
libavcodec/jpeglsenc.c
+21
-10
No files found.
libavcodec/jpeglsenc.c
View file @
6d9c27dc
...
...
@@ -28,6 +28,7 @@
#include "avcodec.h"
#include "get_bits.h"
#include "golomb.h"
#include "internal.h"
#include "mathops.h"
#include "dsputil.h"
#include "mjpeg.h"
...
...
@@ -227,23 +228,19 @@ static void ls_store_lse(JLSState *state, PutBitContext *pb){
put_bits
(
pb
,
16
,
state
->
reset
);
}
static
int
encode_picture_ls
(
AVCodecContext
*
avctx
,
unsigned
char
*
buf
,
int
buf_size
,
void
*
data
){
static
int
encode_picture_ls
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
pict
,
int
*
got_packet
)
{
JpeglsContext
*
const
s
=
avctx
->
priv_data
;
AVFrame
*
pict
=
data
;
AVFrame
*
const
p
=
(
AVFrame
*
)
&
s
->
picture
;
const
int
near
=
avctx
->
prediction_method
;
PutBitContext
pb
,
pb2
;
GetBitContext
gb
;
uint8_t
*
buf2
,
*
zero
,
*
cur
,
*
last
;
JLSState
*
state
;
int
i
,
size
;
int
i
,
size
,
ret
;
int
comps
;
buf2
=
av_malloc
(
buf_size
);
init_put_bits
(
&
pb
,
buf
,
buf_size
);
init_put_bits
(
&
pb2
,
buf2
,
buf_size
);
*
p
=
*
pict
;
p
->
pict_type
=
AV_PICTURE_TYPE_I
;
p
->
key_frame
=
1
;
...
...
@@ -253,6 +250,17 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_
else
comps
=
3
;
if
((
ret
=
ff_alloc_packet
(
pkt
,
avctx
->
width
*
avctx
->
height
*
comps
*
4
+
FF_MIN_BUFFER_SIZE
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error getting output packet.
\n
"
);
return
ret
;
}
buf2
=
av_malloc
(
pkt
->
size
);
init_put_bits
(
&
pb
,
pkt
->
data
,
pkt
->
size
);
init_put_bits
(
&
pb2
,
buf2
,
pkt
->
size
);
/* write our own JPEG header, can't use mjpeg_picture_header */
put_marker
(
&
pb
,
SOI
);
put_marker
(
&
pb
,
SOF48
);
...
...
@@ -366,7 +374,10 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_
emms_c
();
return
put_bits_count
(
&
pb
)
>>
3
;
pkt
->
size
=
put_bits_count
(
&
pb
)
>>
3
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
*
got_packet
=
1
;
return
0
;
}
static
av_cold
int
encode_init_ls
(
AVCodecContext
*
ctx
)
{
...
...
@@ -388,7 +399,7 @@ AVCodec ff_jpegls_encoder = { //FIXME avoid MPV_* lossless JPEG should not need
.
id
=
CODEC_ID_JPEGLS
,
.
priv_data_size
=
sizeof
(
JpeglsContext
),
.
init
=
encode_init_ls
,
.
encode
=
encode_picture_ls
,
.
encode
2
=
encode_picture_ls
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_BGR24
,
PIX_FMT_RGB24
,
PIX_FMT_GRAY8
,
PIX_FMT_GRAY16
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"JPEG-LS"
),
};
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