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
ce2217b2
Commit
ce2217b2
authored
Aug 07, 2016
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/ffv1: add AV_PIX_FMT_GBRP16 support
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
74314f1f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
2 deletions
+45
-2
ffv1.c
libavcodec/ffv1.c
+7
-1
ffv1.h
libavcodec/ffv1.h
+9
-0
ffv1dec.c
libavcodec/ffv1dec.c
+12
-0
ffv1enc.c
libavcodec/ffv1enc.c
+17
-1
No files found.
libavcodec/ffv1.c
View file @
ce2217b2
...
...
@@ -144,7 +144,11 @@ av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f)
fs
->
sample_buffer
=
av_malloc_array
((
fs
->
width
+
6
),
3
*
MAX_PLANES
*
sizeof
(
*
fs
->
sample_buffer
));
if
(
!
fs
->
sample_buffer
)
{
fs
->
sample_buffer32
=
av_malloc_array
((
fs
->
width
+
6
),
3
*
MAX_PLANES
*
sizeof
(
*
fs
->
sample_buffer32
));
if
(
!
fs
->
sample_buffer
||
!
fs
->
sample_buffer32
)
{
av_freep
(
&
fs
->
sample_buffer
);
av_freep
(
&
fs
->
sample_buffer32
);
av_freep
(
&
f
->
slice_context
[
i
]);
goto
memfail
;
}
...
...
@@ -154,6 +158,7 @@ av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f)
memfail:
while
(
--
i
>=
0
)
{
av_freep
(
&
f
->
slice_context
[
i
]
->
sample_buffer
);
av_freep
(
&
f
->
slice_context
[
i
]
->
sample_buffer32
);
av_freep
(
&
f
->
slice_context
[
i
]);
}
return
AVERROR
(
ENOMEM
);
...
...
@@ -224,6 +229,7 @@ av_cold int ff_ffv1_close(AVCodecContext *avctx)
av_freep
(
&
p
->
vlc_state
);
}
av_freep
(
&
fs
->
sample_buffer
);
av_freep
(
&
fs
->
sample_buffer32
);
}
av_freep
(
&
avctx
->
stats_out
);
...
...
libavcodec/ffv1.h
View file @
ce2217b2
...
...
@@ -109,6 +109,9 @@ typedef struct FFV1Context {
int
run_index
;
int
colorspace
;
int16_t
*
sample_buffer
;
int32_t
*
sample_buffer32
;
int
use32bit
;
int
ec
;
int
intra
;
...
...
@@ -198,4 +201,10 @@ static inline void update_vlc_state(VlcState *const state, const int v)
#undef TYPE
#undef RENAME
#define TYPE int32_t
#define RENAME(name) name ## 32
#include "ffv1_template.c"
#undef TYPE
#undef RENAME
#endif
/* AVCODEC_FFV1_H */
libavcodec/ffv1dec.c
View file @
ce2217b2
...
...
@@ -103,6 +103,9 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState *const state,
#undef TYPE
#undef RENAME
#define TYPE int32_t
#define RENAME(name) name ## 32
#include "ffv1dec_template.c"
static
void
decode_plane
(
FFV1Context
*
s
,
uint8_t
*
src
,
int
w
,
int
h
,
int
stride
,
int
plane_index
,
...
...
@@ -318,6 +321,11 @@ static int decode_slice(AVCodecContext *c, void *arg)
}
else
if
(
f
->
colorspace
==
0
)
{
decode_plane
(
fs
,
p
->
data
[
0
]
+
ps
*
x
+
y
*
p
->
linesize
[
0
]
,
width
,
height
,
p
->
linesize
[
0
],
0
,
2
);
decode_plane
(
fs
,
p
->
data
[
0
]
+
ps
*
x
+
y
*
p
->
linesize
[
0
]
+
1
,
width
,
height
,
p
->
linesize
[
0
],
1
,
2
);
}
else
if
(
f
->
use32bit
)
{
uint8_t
*
planes
[
3
]
=
{
p
->
data
[
0
]
+
ps
*
x
+
y
*
p
->
linesize
[
0
],
p
->
data
[
1
]
+
ps
*
x
+
y
*
p
->
linesize
[
1
],
p
->
data
[
2
]
+
ps
*
x
+
y
*
p
->
linesize
[
2
]
};
decode_rgb_frame32
(
fs
,
planes
,
width
,
height
,
p
->
linesize
);
}
else
{
uint8_t
*
planes
[
3
]
=
{
p
->
data
[
0
]
+
ps
*
x
+
y
*
p
->
linesize
[
0
],
p
->
data
[
1
]
+
ps
*
x
+
y
*
p
->
linesize
[
1
],
...
...
@@ -648,6 +656,10 @@ static int read_header(FFV1Context *f)
f
->
avctx
->
pix_fmt
=
AV_PIX_FMT_GBRP12
;
else
if
(
f
->
avctx
->
bits_per_raw_sample
==
14
&&
!
f
->
transparency
)
f
->
avctx
->
pix_fmt
=
AV_PIX_FMT_GBRP14
;
else
if
(
f
->
avctx
->
bits_per_raw_sample
==
16
&&
!
f
->
transparency
)
{
f
->
avctx
->
pix_fmt
=
AV_PIX_FMT_GBRP16
;
f
->
use32bit
=
1
;
}
}
else
{
av_log
(
f
->
avctx
,
AV_LOG_ERROR
,
"colorspace not supported
\n
"
);
return
AVERROR
(
ENOSYS
);
...
...
libavcodec/ffv1enc.c
View file @
ce2217b2
...
...
@@ -274,6 +274,9 @@ static inline void put_vlc_symbol(PutBitContext *pb, VlcState *const state,
#undef TYPE
#undef RENAME
#define TYPE int32_t
#define RENAME(name) name ## 32
#include "ffv1enc_template.c"
static
int
encode_plane
(
FFV1Context
*
s
,
uint8_t
*
src
,
int
w
,
int
h
,
int
stride
,
int
plane_index
,
int
pixel_stride
)
...
...
@@ -643,10 +646,20 @@ FF_ENABLE_DEPRECATION_WARNINGS
case
AV_PIX_FMT_GBRP14
:
if
(
!
avctx
->
bits_per_raw_sample
&&
!
s
->
bits_per_raw_sample
)
s
->
bits_per_raw_sample
=
14
;
case
AV_PIX_FMT_GBRP16
:
if
(
!
avctx
->
bits_per_raw_sample
&&
!
s
->
bits_per_raw_sample
)
s
->
bits_per_raw_sample
=
16
;
else
if
(
!
s
->
bits_per_raw_sample
)
s
->
bits_per_raw_sample
=
avctx
->
bits_per_raw_sample
;
s
->
colorspace
=
1
;
s
->
chroma_planes
=
1
;
if
(
s
->
bits_per_raw_sample
>=
16
)
{
s
->
use32bit
=
1
;
if
(
avctx
->
strict_std_compliance
>
FF_COMPLIANCE_EXPERIMENTAL
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"16bit RGB is experimental and under development, only use it for experiments
\n
"
);
return
AVERROR_INVALIDDATA
;
}
}
s
->
version
=
FFMAX
(
s
->
version
,
1
);
if
(
s
->
ac
==
AC_GOLOMB_RICE
)
{
av_log
(
avctx
,
AV_LOG_INFO
,
...
...
@@ -1040,6 +1053,8 @@ retry:
}
else
if
(
c
->
pix_fmt
==
AV_PIX_FMT_YA8
)
{
ret
=
encode_plane
(
fs
,
p
->
data
[
0
]
+
ps
*
x
+
y
*
p
->
linesize
[
0
],
width
,
height
,
p
->
linesize
[
0
],
0
,
2
);
ret
|=
encode_plane
(
fs
,
p
->
data
[
0
]
+
1
+
ps
*
x
+
y
*
p
->
linesize
[
0
],
width
,
height
,
p
->
linesize
[
0
],
1
,
2
);
}
else
if
(
f
->
use32bit
)
{
ret
=
encode_rgb_frame32
(
fs
,
planes
,
width
,
height
,
p
->
linesize
);
}
else
{
ret
=
encode_rgb_frame
(
fs
,
planes
,
width
,
height
,
p
->
linesize
);
}
...
...
@@ -1071,7 +1086,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t
*
buf_p
;
int
i
,
ret
;
int64_t
maxsize
=
AV_INPUT_BUFFER_MIN_SIZE
+
avctx
->
width
*
avctx
->
height
*
3
5
LL
*
4
;
+
avctx
->
width
*
avctx
->
height
*
3
7
LL
*
4
;
if
(
!
pict
)
{
if
(
avctx
->
flags
&
AV_CODEC_FLAG_PASS1
)
{
...
...
@@ -1275,6 +1290,7 @@ AVCodec ff_ffv1_encoder = {
AV_PIX_FMT_GRAY16
,
AV_PIX_FMT_GRAY8
,
AV_PIX_FMT_GBRP9
,
AV_PIX_FMT_GBRP10
,
AV_PIX_FMT_GBRP12
,
AV_PIX_FMT_GBRP14
,
AV_PIX_FMT_YA8
,
AV_PIX_FMT_GBRP16
,
AV_PIX_FMT_NONE
},
...
...
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