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
8adbe26b
Commit
8adbe26b
authored
Feb 27, 2016
by
Kieran Kunhya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/cfhd: Add support for 12-bit RGBA.
Plays all known samples
parent
0096453f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
cfhd.c
libavcodec/cfhd.c
+15
-9
No files found.
libavcodec/cfhd.c
View file @
8adbe26b
...
@@ -141,7 +141,7 @@ static void free_buffers(AVCodecContext *avctx)
...
@@ -141,7 +141,7 @@ static void free_buffers(AVCodecContext *avctx)
CFHDContext
*
s
=
avctx
->
priv_data
;
CFHDContext
*
s
=
avctx
->
priv_data
;
int
i
;
int
i
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
av_freep
(
&
s
->
plane
[
i
].
idwt_buf
);
av_freep
(
&
s
->
plane
[
i
].
idwt_buf
);
av_freep
(
&
s
->
plane
[
i
].
idwt_tmp
);
av_freep
(
&
s
->
plane
[
i
].
idwt_tmp
);
}
}
...
@@ -152,15 +152,16 @@ static void free_buffers(AVCodecContext *avctx)
...
@@ -152,15 +152,16 @@ static void free_buffers(AVCodecContext *avctx)
static
int
alloc_buffers
(
AVCodecContext
*
avctx
)
static
int
alloc_buffers
(
AVCodecContext
*
avctx
)
{
{
CFHDContext
*
s
=
avctx
->
priv_data
;
CFHDContext
*
s
=
avctx
->
priv_data
;
int
i
,
j
,
k
,
ret
;
int
i
,
j
,
k
,
ret
,
planes
;
if
((
ret
=
ff_set_dimensions
(
avctx
,
s
->
coded_width
,
s
->
coded_height
))
<
0
)
if
((
ret
=
ff_set_dimensions
(
avctx
,
s
->
coded_width
,
s
->
coded_height
))
<
0
)
return
ret
;
return
ret
;
avctx
->
pix_fmt
=
s
->
coded_format
;
avctx
->
pix_fmt
=
s
->
coded_format
;
avcodec_get_chroma_sub_sample
(
avctx
->
pix_fmt
,
&
s
->
chroma_x_shift
,
&
s
->
chroma_y_shift
);
avcodec_get_chroma_sub_sample
(
avctx
->
pix_fmt
,
&
s
->
chroma_x_shift
,
&
s
->
chroma_y_shift
);
planes
=
av_pix_fmt_count_planes
(
avctx
->
pix_fmt
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
planes
;
i
++
)
{
int
width
=
i
?
avctx
->
width
>>
s
->
chroma_x_shift
:
avctx
->
width
;
int
width
=
i
?
avctx
->
width
>>
s
->
chroma_x_shift
:
avctx
->
width
;
int
height
=
i
?
avctx
->
height
>>
s
->
chroma_y_shift
:
avctx
->
height
;
int
height
=
i
?
avctx
->
height
>>
s
->
chroma_y_shift
:
avctx
->
height
;
int
stride
=
FFALIGN
(
width
/
8
,
8
)
*
8
;
int
stride
=
FFALIGN
(
width
/
8
,
8
)
*
8
;
...
@@ -226,11 +227,12 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -226,11 +227,12 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
GetByteContext
gb
;
GetByteContext
gb
;
ThreadFrame
frame
=
{
.
f
=
data
};
ThreadFrame
frame
=
{
.
f
=
data
};
AVFrame
*
pic
=
data
;
AVFrame
*
pic
=
data
;
int
ret
=
0
,
i
,
j
,
plane
,
got_buffer
=
0
;
int
ret
=
0
,
i
,
j
,
plane
s
,
plane
,
got_buffer
=
0
;
int16_t
*
coeff_data
;
int16_t
*
coeff_data
;
s
->
coded_format
=
AV_PIX_FMT_YUV422P10
;
s
->
coded_format
=
AV_PIX_FMT_YUV422P10
;
init_frame_defaults
(
s
);
init_frame_defaults
(
s
);
planes
=
av_pix_fmt_count_planes
(
s
->
coded_format
);
bytestream2_init
(
&
gb
,
avpkt
->
data
,
avpkt
->
size
);
bytestream2_init
(
&
gb
,
avpkt
->
data
,
avpkt
->
size
);
...
@@ -256,7 +258,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -256,7 +258,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
}
else
if
(
tag
==
12
)
{
}
else
if
(
tag
==
12
)
{
av_log
(
avctx
,
AV_LOG_DEBUG
,
"Channel Count: %"
PRIu16
"
\n
"
,
data
);
av_log
(
avctx
,
AV_LOG_DEBUG
,
"Channel Count: %"
PRIu16
"
\n
"
,
data
);
s
->
channel_cnt
=
data
;
s
->
channel_cnt
=
data
;
if
(
data
!=
3
)
{
if
(
data
>
4
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Channel Count of %"
PRIu16
" is unsupported
\n
"
,
data
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Channel Count of %"
PRIu16
" is unsupported
\n
"
,
data
);
ret
=
AVERROR_PATCHWELCOME
;
ret
=
AVERROR_PATCHWELCOME
;
break
;
break
;
...
@@ -271,7 +273,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -271,7 +273,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
}
else
if
(
tag
==
62
)
{
}
else
if
(
tag
==
62
)
{
s
->
channel_num
=
data
;
s
->
channel_num
=
data
;
av_log
(
avctx
,
AV_LOG_DEBUG
,
"Channel number %"
PRIu16
"
\n
"
,
data
);
av_log
(
avctx
,
AV_LOG_DEBUG
,
"Channel number %"
PRIu16
"
\n
"
,
data
);
if
(
s
->
channel_num
>
2
)
{
if
(
s
->
channel_num
>
=
planes
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid channel number
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid channel number
\n
"
);
ret
=
AVERROR
(
EINVAL
);
ret
=
AVERROR
(
EINVAL
);
break
;
break
;
...
@@ -410,11 +412,14 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -410,11 +412,14 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
s
->
coded_format
=
AV_PIX_FMT_YUV422P10
;
s
->
coded_format
=
AV_PIX_FMT_YUV422P10
;
else
if
(
data
==
3
)
else
if
(
data
==
3
)
s
->
coded_format
=
AV_PIX_FMT_GBRP12
;
s
->
coded_format
=
AV_PIX_FMT_GBRP12
;
else
if
(
data
==
4
)
s
->
coded_format
=
AV_PIX_FMT_GBRAP12
;
else
{
else
{
avpriv_report_missing_feature
(
avctx
,
"Sample format of %"
PRIu16
" is unsupported
\n
"
,
data
);
avpriv_report_missing_feature
(
avctx
,
"Sample format of %"
PRIu16
" is unsupported
\n
"
,
data
);
ret
=
AVERROR_PATCHWELCOME
;
ret
=
AVERROR_PATCHWELCOME
;
break
;
break
;
}
}
planes
=
av_pix_fmt_count_planes
(
s
->
coded_format
);
}
else
}
else
av_log
(
avctx
,
AV_LOG_DEBUG
,
"Unknown tag %i data %x
\n
"
,
tag
,
data
);
av_log
(
avctx
,
AV_LOG_DEBUG
,
"Unknown tag %i data %x
\n
"
,
tag
,
data
);
...
@@ -575,12 +580,13 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -575,12 +580,13 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
goto
end
;
goto
end
;
}
}
for
(
plane
=
0
;
plane
<
3
&&
!
ret
;
plane
++
)
{
planes
=
av_pix_fmt_count_planes
(
avctx
->
pix_fmt
);
for
(
plane
=
0
;
plane
<
planes
&&
!
ret
;
plane
++
)
{
/* level 1 */
/* level 1 */
int
lowpass_height
=
s
->
plane
[
plane
].
band
[
0
][
0
].
height
;
int
lowpass_height
=
s
->
plane
[
plane
].
band
[
0
][
0
].
height
;
int
lowpass_width
=
s
->
plane
[
plane
].
band
[
0
][
0
].
width
;
int
lowpass_width
=
s
->
plane
[
plane
].
band
[
0
][
0
].
width
;
int
highpass_stride
=
s
->
plane
[
plane
].
band
[
0
][
1
].
stride
;
int
highpass_stride
=
s
->
plane
[
plane
].
band
[
0
][
1
].
stride
;
int
act_plane
=
plane
==
1
?
2
:
plane
==
2
?
1
:
0
;
int
act_plane
=
plane
==
1
?
2
:
plane
==
2
?
1
:
plane
;
int16_t
*
low
,
*
high
,
*
output
,
*
dst
;
int16_t
*
low
,
*
high
,
*
output
,
*
dst
;
if
(
lowpass_height
>
s
->
plane
[
plane
].
band
[
0
][
0
].
a_height
||
lowpass_width
>
s
->
plane
[
plane
].
band
[
0
][
0
].
a_width
||
if
(
lowpass_height
>
s
->
plane
[
plane
].
band
[
0
][
0
].
a_height
||
lowpass_width
>
s
->
plane
[
plane
].
band
[
0
][
0
].
a_width
||
...
@@ -623,7 +629,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -623,7 +629,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
high
+=
lowpass_width
;
high
+=
lowpass_width
;
output
+=
lowpass_width
*
2
;
output
+=
lowpass_width
*
2
;
}
}
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_GBRP
12
)
{
if
(
s
->
bpc
==
12
)
{
output
=
s
->
plane
[
plane
].
subband
[
0
];
output
=
s
->
plane
[
plane
].
subband
[
0
];
for
(
i
=
0
;
i
<
lowpass_height
*
2
;
i
++
)
{
for
(
i
=
0
;
i
<
lowpass_height
*
2
;
i
++
)
{
for
(
j
=
0
;
j
<
lowpass_width
*
2
;
j
++
)
for
(
j
=
0
;
j
<
lowpass_width
*
2
;
j
++
)
...
...
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