Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
706a9292
Commit
706a9292
authored
Nov 09, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jpegls: use the AVFrame API properly.
parent
14b35bf0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
13 deletions
+15
-13
jpegls.h
libavcodec/jpegls.h
+0
-1
jpeglsenc.c
libavcodec/jpeglsenc.c
+15
-12
No files found.
libavcodec/jpegls.h
View file @
706a9292
...
@@ -33,7 +33,6 @@
...
@@ -33,7 +33,6 @@
typedef
struct
JpeglsContext
{
typedef
struct
JpeglsContext
{
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
AVFrame
picture
;
}
JpeglsContext
;
}
JpeglsContext
;
typedef
struct
JLSState
{
typedef
struct
JLSState
{
...
...
libavcodec/jpeglsenc.c
View file @
706a9292
...
@@ -248,8 +248,7 @@ static void ls_store_lse(JLSState *state, PutBitContext *pb)
...
@@ -248,8 +248,7 @@ static void ls_store_lse(JLSState *state, PutBitContext *pb)
static
int
encode_picture_ls
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
static
int
encode_picture_ls
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
pict
,
int
*
got_packet
)
const
AVFrame
*
pict
,
int
*
got_packet
)
{
{
JpeglsContext
*
const
s
=
avctx
->
priv_data
;
const
AVFrame
*
const
p
=
pict
;
AVFrame
*
const
p
=
&
s
->
picture
;
const
int
near
=
avctx
->
prediction_method
;
const
int
near
=
avctx
->
prediction_method
;
PutBitContext
pb
,
pb2
;
PutBitContext
pb
,
pb2
;
GetBitContext
gb
;
GetBitContext
gb
;
...
@@ -258,10 +257,6 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -258,10 +257,6 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
int
i
,
size
,
ret
;
int
i
,
size
,
ret
;
int
comps
;
int
comps
;
*
p
=
*
pict
;
p
->
pict_type
=
AV_PICTURE_TYPE_I
;
p
->
key_frame
=
1
;
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_GRAY8
||
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_GRAY8
||
avctx
->
pix_fmt
==
AV_PIX_FMT_GRAY16
)
avctx
->
pix_fmt
==
AV_PIX_FMT_GRAY16
)
comps
=
1
;
comps
=
1
;
...
@@ -346,7 +341,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -346,7 +341,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
Rc
[
j
]
=
last
[
j
];
Rc
[
j
]
=
last
[
j
];
}
}
last
=
cur
;
last
=
cur
;
cur
+=
s
->
picture
.
linesize
[
0
];
cur
+=
p
->
linesize
[
0
];
}
}
}
else
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_BGR24
)
{
}
else
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_BGR24
)
{
int
j
,
width
;
int
j
,
width
;
...
@@ -360,7 +355,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -360,7 +355,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
Rc
[
j
]
=
last
[
j
];
Rc
[
j
]
=
last
[
j
];
}
}
last
=
cur
;
last
=
cur
;
cur
+=
s
->
picture
.
linesize
[
0
];
cur
+=
p
->
linesize
[
0
];
}
}
}
}
...
@@ -400,12 +395,20 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -400,12 +395,20 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
return
0
;
return
0
;
}
}
static
av_cold
int
encode_close
(
AVCodecContext
*
avctx
)
{
av_frame_free
(
&
avctx
->
coded_frame
);
return
0
;
}
static
av_cold
int
encode_init_ls
(
AVCodecContext
*
ctx
)
static
av_cold
int
encode_init_ls
(
AVCodecContext
*
ctx
)
{
{
JpeglsContext
*
c
=
(
JpeglsContext
*
)
ctx
->
priv_data
;
ctx
->
coded_frame
=
av_frame_alloc
();
if
(
!
ctx
->
coded_frame
)
return
AVERROR
(
ENOMEM
);
c
->
avctx
=
ctx
;
c
tx
->
coded_frame
->
pict_type
=
AV_PICTURE_TYPE_I
;
ctx
->
coded_frame
=
&
c
->
picture
;
ctx
->
coded_frame
->
key_frame
=
1
;
if
(
ctx
->
pix_fmt
!=
AV_PIX_FMT_GRAY8
&&
if
(
ctx
->
pix_fmt
!=
AV_PIX_FMT_GRAY8
&&
ctx
->
pix_fmt
!=
AV_PIX_FMT_GRAY16
&&
ctx
->
pix_fmt
!=
AV_PIX_FMT_GRAY16
&&
...
@@ -423,8 +426,8 @@ AVCodec ff_jpegls_encoder = {
...
@@ -423,8 +426,8 @@ AVCodec ff_jpegls_encoder = {
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"JPEG-LS"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"JPEG-LS"
),
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_JPEGLS
,
.
id
=
AV_CODEC_ID_JPEGLS
,
.
priv_data_size
=
sizeof
(
JpeglsContext
),
.
init
=
encode_init_ls
,
.
init
=
encode_init_ls
,
.
close
=
encode_close
,
.
encode2
=
encode_picture_ls
,
.
encode2
=
encode_picture_ls
,
.
pix_fmts
=
(
const
enum
AVPixelFormat
[])
{
.
pix_fmts
=
(
const
enum
AVPixelFormat
[])
{
AV_PIX_FMT_BGR24
,
AV_PIX_FMT_RGB24
,
AV_PIX_FMT_BGR24
,
AV_PIX_FMT_RGB24
,
...
...
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