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
51c4d870
Commit
51c4d870
authored
Apr 09, 2012
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vcr1: group encoder code together to save #ifdefs
parent
db1e403c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
47 deletions
+43
-47
vcr1.c
libavcodec/vcr1.c
+43
-47
No files found.
libavcodec/vcr1.c
View file @
51c4d870
...
@@ -27,10 +27,6 @@
...
@@ -27,10 +27,6 @@
#include "avcodec.h"
#include "avcodec.h"
#include "dsputil.h"
#include "dsputil.h"
/* Disable the encoder. */
#undef CONFIG_VCR1_ENCODER
#define CONFIG_VCR1_ENCODER 0
typedef
struct
VCR1Context
{
typedef
struct
VCR1Context
{
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
AVFrame
picture
;
AVFrame
picture
;
...
@@ -38,6 +34,33 @@ typedef struct VCR1Context {
...
@@ -38,6 +34,33 @@ typedef struct VCR1Context {
int
offset
[
4
];
int
offset
[
4
];
}
VCR1Context
;
}
VCR1Context
;
static
av_cold
void
common_init
(
AVCodecContext
*
avctx
)
{
VCR1Context
*
const
a
=
avctx
->
priv_data
;
avctx
->
coded_frame
=
&
a
->
picture
;
a
->
avctx
=
avctx
;
}
static
av_cold
int
decode_init
(
AVCodecContext
*
avctx
)
{
common_init
(
avctx
);
avctx
->
pix_fmt
=
PIX_FMT_YUV410P
;
return
0
;
}
static
av_cold
int
decode_end
(
AVCodecContext
*
avctx
)
{
VCR1Context
*
s
=
avctx
->
priv_data
;
if
(
s
->
picture
.
data
[
0
])
avctx
->
release_buffer
(
avctx
,
&
s
->
picture
);
return
0
;
}
static
int
decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
static
int
decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
data_size
,
AVPacket
*
avpkt
)
int
*
data_size
,
AVPacket
*
avpkt
)
{
{
...
@@ -113,6 +136,22 @@ static int decode_frame(AVCodecContext *avctx, void *data,
...
@@ -113,6 +136,22 @@ static int decode_frame(AVCodecContext *avctx, void *data,
return
buf_size
;
return
buf_size
;
}
}
AVCodec
ff_vcr1_decoder
=
{
.
name
=
"vcr1"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
CODEC_ID_VCR1
,
.
priv_data_size
=
sizeof
(
VCR1Context
),
.
init
=
decode_init
,
.
close
=
decode_end
,
.
decode
=
decode_frame
,
.
capabilities
=
CODEC_CAP_DR1
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"ATI VCR1"
),
};
/* Disable the encoder. */
#undef CONFIG_VCR1_ENCODER
#define CONFIG_VCR1_ENCODER 0
#if CONFIG_VCR1_ENCODER
#if CONFIG_VCR1_ENCODER
static
int
encode_frame
(
AVCodecContext
*
avctx
,
unsigned
char
*
buf
,
static
int
encode_frame
(
AVCodecContext
*
avctx
,
unsigned
char
*
buf
,
int
buf_size
,
void
*
data
)
int
buf_size
,
void
*
data
)
...
@@ -134,57 +173,14 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
...
@@ -134,57 +173,14 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
return
size
*
4
;
return
size
*
4
;
}
}
#endif
static
av_cold
void
common_init
(
AVCodecContext
*
avctx
)
{
VCR1Context
*
const
a
=
avctx
->
priv_data
;
avctx
->
coded_frame
=
&
a
->
picture
;
a
->
avctx
=
avctx
;
}
static
av_cold
int
decode_init
(
AVCodecContext
*
avctx
)
{
common_init
(
avctx
);
avctx
->
pix_fmt
=
PIX_FMT_YUV410P
;
return
0
;
}
static
av_cold
int
decode_end
(
AVCodecContext
*
avctx
)
{
VCR1Context
*
s
=
avctx
->
priv_data
;
if
(
s
->
picture
.
data
[
0
])
avctx
->
release_buffer
(
avctx
,
&
s
->
picture
);
return
0
;
}
#if CONFIG_VCR1_ENCODER
static
av_cold
int
encode_init
(
AVCodecContext
*
avctx
)
static
av_cold
int
encode_init
(
AVCodecContext
*
avctx
)
{
{
common_init
(
avctx
);
common_init
(
avctx
);
return
0
;
return
0
;
}
}
#endif
AVCodec
ff_vcr1_decoder
=
{
.
name
=
"vcr1"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
CODEC_ID_VCR1
,
.
priv_data_size
=
sizeof
(
VCR1Context
),
.
init
=
decode_init
,
.
close
=
decode_end
,
.
decode
=
decode_frame
,
.
capabilities
=
CODEC_CAP_DR1
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"ATI VCR1"
),
};
#if CONFIG_VCR1_ENCODER
AVCodec
ff_vcr1_encoder
=
{
AVCodec
ff_vcr1_encoder
=
{
.
name
=
"vcr1"
,
.
name
=
"vcr1"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
...
...
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