Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
40bae5be
Commit
40bae5be
authored
Apr 17, 2023
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: add PDV decoder
parent
0760528a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
140 additions
and
1 deletion
+140
-1
Changelog
Changelog
+1
-0
configure
configure
+1
-0
Makefile
libavcodec/Makefile
+1
-0
allcodecs.c
libavcodec/allcodecs.c
+1
-0
codec_desc.c
libavcodec/codec_desc.c
+7
-0
codec_id.h
libavcodec/codec_id.h
+1
-0
pdvdec.c
libavcodec/pdvdec.c
+127
-0
version.h
libavcodec/version.h
+1
-1
No files found.
Changelog
View file @
40bae5be
...
...
@@ -3,6 +3,7 @@ releases are sorted from youngest to oldest.
version <next>:
- libaribcaption decoder
- Playdate video decoder
version 6.0:
- Radiance HDR image support
...
...
configure
View file @
40bae5be
...
...
@@ -2899,6 +2899,7 @@ notchlc_decoder_select="lzf"
nuv_decoder_select
=
"idctdsp"
opus_decoder_deps
=
"swresample"
opus_encoder_select
=
"audio_frame_queue"
pdv_decoder_deps
=
"zlib"
png_decoder_select
=
"inflate_wrapper"
png_encoder_select
=
"deflate_wrapper llvidencdsp"
prores_decoder_select
=
"blockdsp idctdsp"
...
...
libavcodec/Makefile
View file @
40bae5be
...
...
@@ -583,6 +583,7 @@ OBJS-$(CONFIG_PBM_DECODER) += pnmdec.o pnm.o
OBJS-$(CONFIG_PBM_ENCODER)
+=
pnmenc.o
OBJS-$(CONFIG_PCX_DECODER)
+=
pcx.o
OBJS-$(CONFIG_PCX_ENCODER)
+=
pcxenc.o
OBJS-$(CONFIG_PDV_DECODER)
+=
pdvdec.o
OBJS-$(CONFIG_PFM_DECODER)
+=
pnmdec.o
pnm.o
OBJS-$(CONFIG_PFM_ENCODER)
+=
pnmenc.o
OBJS-$(CONFIG_PGM_DECODER)
+=
pnmdec.o
pnm.o
...
...
libavcodec/allcodecs.c
View file @
40bae5be
...
...
@@ -251,6 +251,7 @@ extern const FFCodec ff_pbm_encoder;
extern
const
FFCodec
ff_pbm_decoder
;
extern
const
FFCodec
ff_pcx_encoder
;
extern
const
FFCodec
ff_pcx_decoder
;
extern
const
FFCodec
ff_pdv_decoder
;
extern
const
FFCodec
ff_pfm_encoder
;
extern
const
FFCodec
ff_pfm_decoder
;
extern
const
FFCodec
ff_pgm_encoder
;
...
...
libavcodec/codec_desc.c
View file @
40bae5be
...
...
@@ -1923,6 +1923,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"ViewQuest VQC"
),
.
props
=
AV_CODEC_PROP_LOSSY
,
},
{
.
id
=
AV_CODEC_ID_PDV
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
name
=
"pdv"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"PDV (PlayDate Video)"
),
.
props
=
AV_CODEC_PROP_LOSSY
,
},
/* various PCM "codecs" */
{
...
...
libavcodec/codec_id.h
View file @
40bae5be
...
...
@@ -320,6 +320,7 @@ enum AVCodecID {
AV_CODEC_ID_WBMP
,
AV_CODEC_ID_MEDIA100
,
AV_CODEC_ID_VQC
,
AV_CODEC_ID_PDV
,
/* various PCM "codecs" */
AV_CODEC_ID_FIRST_AUDIO
=
0x10000
,
///< A dummy id pointing at the start of audio codecs
...
...
libavcodec/pdvdec.c
0 → 100644
View file @
40bae5be
/*
* PDV video format
*
* Copyright (c) 2023 Paul B Mahol
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"
#include "zlib_wrapper.h"
#include <zlib.h>
typedef
struct
PDVContext
{
AVFrame
*
previous_frame
;
FFZStream
zstream
;
}
PDVContext
;
static
av_cold
int
decode_init
(
AVCodecContext
*
avctx
)
{
PDVContext
*
s
=
avctx
->
priv_data
;
avctx
->
pix_fmt
=
AV_PIX_FMT_MONOBLACK
;
s
->
previous_frame
=
av_frame_alloc
();
if
(
!
s
->
previous_frame
)
return
AVERROR
(
ENOMEM
);
return
ff_inflate_init
(
&
s
->
zstream
,
avctx
);
}
static
av_cold
int
decode_end
(
AVCodecContext
*
avctx
)
{
PDVContext
*
s
=
avctx
->
priv_data
;
av_frame_free
(
&
s
->
previous_frame
);
ff_inflate_end
(
&
s
->
zstream
);
return
0
;
}
static
int
decode_frame
(
AVCodecContext
*
avctx
,
AVFrame
*
frame
,
int
*
got_frame
,
AVPacket
*
avpkt
)
{
PDVContext
*
s
=
avctx
->
priv_data
;
AVFrame
*
prev_frame
=
s
->
previous_frame
;
z_stream
*
const
zstream
=
&
s
->
zstream
.
zstream
;
uint8_t
*
dst
,
*
prev
=
prev_frame
->
data
[
0
];
int
ret
,
zret
;
zret
=
inflateReset
(
zstream
);
if
(
zret
!=
Z_OK
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Could not reset inflate: %d.
\n
"
,
zret
);
return
AVERROR_INVALIDDATA
;
}
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
,
AV_GET_BUFFER_FLAG_REF
))
<
0
)
return
ret
;
zstream
->
next_in
=
avpkt
->
data
;
zstream
->
avail_in
=
avpkt
->
size
;
dst
=
frame
->
data
[
0
];
for
(
int
i
=
0
;
i
<
avctx
->
height
;
i
++
)
{
zstream
->
next_out
=
dst
;
zstream
->
avail_out
=
(
avctx
->
width
+
7
)
>>
3
;
zret
=
inflate
(
zstream
,
Z_SYNC_FLUSH
);
if
(
zret
!=
Z_OK
&&
zret
!=
Z_STREAM_END
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Inflate failed with return code: %d.
\n
"
,
zret
);
return
AVERROR_INVALIDDATA
;
}
if
(
!
(
avpkt
->
flags
&
AV_PKT_FLAG_KEY
))
{
for
(
int
j
=
0
;
j
<
(
avctx
->
width
+
7
)
>>
3
;
j
++
)
dst
[
j
]
^=
prev
[
j
];
prev
+=
prev_frame
->
linesize
[
0
];
}
dst
+=
frame
->
linesize
[
0
];
}
av_frame_unref
(
s
->
previous_frame
);
if
((
ret
=
av_frame_ref
(
s
->
previous_frame
,
frame
))
<
0
)
return
ret
;
if
(
avpkt
->
flags
&
AV_PKT_FLAG_KEY
)
{
frame
->
key_frame
=
1
;
frame
->
pict_type
=
AV_PICTURE_TYPE_I
;
}
else
{
frame
->
pict_type
=
AV_PICTURE_TYPE_P
;
}
*
got_frame
=
1
;
return
avpkt
->
size
;
}
const
FFCodec
ff_pdv_decoder
=
{
.
p
.
name
=
"pdv"
,
CODEC_LONG_NAME
(
"PDV (PlayDate Video)"
),
.
priv_data_size
=
sizeof
(
PDVContext
),
.
p
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
p
.
id
=
AV_CODEC_ID_PDV
,
.
p
.
capabilities
=
AV_CODEC_CAP_DR1
,
.
caps_internal
=
FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
,
.
init
=
decode_init
,
.
close
=
decode_end
,
FF_CODEC_DECODE_CB
(
decode_frame
),
};
libavcodec/version.h
View file @
40bae5be
...
...
@@ -29,7 +29,7 @@
#include "version_major.h"
#define LIBAVCODEC_VERSION_MINOR
9
#define LIBAVCODEC_VERSION_MINOR
10
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
...
...
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