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
6b259e43
Commit
6b259e43
authored
Aug 04, 2007
by
Baptiste Coudurier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnxhd 185 interlaced support
Originally committed as revision 9901 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
dd661ebd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
28 deletions
+51
-28
dnxhddata.h
libavcodec/dnxhddata.h
+16
-18
dnxhddec.c
libavcodec/dnxhddec.c
+35
-10
No files found.
libavcodec/dnxhddata.h
View file @
6b259e43
...
...
@@ -46,28 +46,26 @@ static const uint8_t dnxhd_1238_chroma_weigth[] = {
82
,
77
,
80
,
86
,
84
,
82
,
82
,
82
,
};
/* FIXME permute */
static
const
uint8_t
dnxhd_1243_luma_weigth
[]
=
{
0
,
32
,
35
,
35
,
38
,
40
,
44
,
4
5
,
3
2
,
33
,
35
,
35
,
39
,
42
,
44
,
45
,
3
3
,
35
,
34
,
37
,
41
,
42
,
45
,
45
,
35
,
35
,
37
,
40
,
41
,
44
,
45
,
48
,
35
,
37
,
38
,
40
,
43
,
45
,
47
,
48
,
36
,
36
,
38
,
40
,
45
,
47
,
48
,
47
,
3
5
,
36
,
38
,
41
,
45
,
46
,
47
,
48
,
36
,
37
,
39
,
41
,
44
,
45
,
47
,
47
,
0
,
32
,
32
,
33
,
33
,
35
,
35
,
3
5
,
3
5
,
35
,
35
,
35
,
34
,
35
,
38
,
40
,
3
9
,
37
,
37
,
37
,
36
,
35
,
36
,
38
,
40
,
41
,
42
,
44
,
45
,
44
,
42
,
41
,
40
,
38
,
36
,
36
,
37
,
38
,
40
,
43
,
44
,
45
,
45
,
45
,
45
,
45
,
45
,
41
,
3
9
,
41
,
45
,
47
,
47
,
48
,
48
,
48
,
46
,
44
,
45
,
47
,
47
,
48
,
47
,
47
,
};
/* FIXME permute */
static
const
uint8_t
dnxhd_1243_chroma_weigth
[]
=
{
0
,
32
,
37
,
39
,
41
,
42
,
45
,
45
,
36
,
36
,
39
,
41
,
43
,
45
,
46
,
45
,
37
,
41
,
41
,
43
,
45
,
44
,
45
,
46
,
4
3
,
42
,
43
,
46
,
44
,
45
,
46
,
48
,
4
3
,
44
,
47
,
45
,
44
,
46
,
47
,
49
,
4
4
,
46
,
44
,
45
,
45
,
47
,
48
,
47
,
4
4
,
42
,
46
,
44
,
45
,
46
,
47
,
48
,
4
1
,
43
,
45
,
44
,
45
,
46
,
47
,
47
,
0
,
32
,
36
,
37
,
36
,
37
,
39
,
39
,
41
,
43
,
43
,
42
,
41
,
41
,
41
,
42
,
43
,
43
,
43
,
44
,
44
,
44
,
46
,
47
,
4
6
,
45
,
45
,
45
,
45
,
46
,
44
,
44
,
4
5
,
44
,
42
,
41
,
43
,
46
,
45
,
44
,
4
5
,
45
,
45
,
46
,
46
,
46
,
45
,
44
,
4
5
,
44
,
45
,
47
,
47
,
48
,
49
,
48
,
4
6
,
45
,
46
,
47
,
47
,
48
,
47
,
47
,
};
static
const
uint8_t
dnxhd_1238_dc_codes
[
12
]
=
{
...
...
libavcodec/dnxhddec.c
View file @
6b259e43
...
...
@@ -69,12 +69,12 @@ static const CIDEntry cid_table[] = {
dnxhd_1238_ac_codes
,
dnxhd_1238_ac_bits
,
dnxhd_1238_ac_level
,
dnxhd_1238_ac_run_flag
,
dnxhd_1238_ac_index_flag
,
dnxhd_1238_run_codes
,
dnxhd_1238_run_bits
,
dnxhd_1238_run
},
/* { 1243, 1920, 1080, 1, 917504, 458752, 4, 8, */
/* dnxhd_1243_luma_weigth, dnxhd_1243_chroma_weigth, */
/* dnxhd_1238_dc_codes, dnxhd_1238_dc_bits, */
/* dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level, */
/* dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag, */
/* dnxhd_1238_run_codes, dnxhd_1238_run_bits, dnxhd_1238_run }, */
{
1243
,
1920
,
1080
,
1
,
917504
,
458752
,
4
,
8
,
dnxhd_1243_luma_weigth
,
dnxhd_1243_chroma_weigth
,
dnxhd_1238_dc_codes
,
dnxhd_1238_dc_bits
,
dnxhd_1238_ac_codes
,
dnxhd_1238_ac_bits
,
dnxhd_1238_ac_level
,
dnxhd_1238_ac_run_flag
,
dnxhd_1238_ac_index_flag
,
dnxhd_1238_run_codes
,
dnxhd_1238_run_bits
,
dnxhd_1238_run
},
};
static
int
dnxhd_get_cid_table
(
int
cid
)
...
...
@@ -125,7 +125,7 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, int cid)
return
0
;
}
static
int
dnxhd_decode_header
(
DNXHDContext
*
ctx
,
uint8_t
*
buf
,
int
buf_size
)
static
int
dnxhd_decode_header
(
DNXHDContext
*
ctx
,
uint8_t
*
buf
,
int
buf_size
,
int
first_field
)
{
static
const
uint8_t
header_prefix
[]
=
{
0x00
,
0x00
,
0x02
,
0x80
,
0x01
};
int
i
;
...
...
@@ -137,9 +137,11 @@ static int dnxhd_decode_header(DNXHDContext *ctx, uint8_t *buf, int buf_size)
av_log
(
ctx
->
avctx
,
AV_LOG_ERROR
,
"error in header
\n
"
);
return
-
1
;
}
if
(
buf
[
5
]
&
2
)
{
/* interlaced FIXME top or bottom */
if
(
buf
[
5
]
&
2
)
{
/* interlaced */
ctx
->
cur_field
=
buf
[
5
]
&
1
;
ctx
->
picture
.
interlaced_frame
=
1
;
av_log
(
ctx
->
avctx
,
AV_LOG_DEBUG
,
"interlaced %d
\n
"
,
buf
[
5
]
&
3
);
ctx
->
picture
.
top_field_first
=
first_field
&&
ctx
->
cur_field
==
1
;
av_log
(
ctx
->
avctx
,
AV_LOG_DEBUG
,
"interlaced %d, cur field %d
\n
"
,
buf
[
5
]
&
3
,
ctx
->
cur_field
);
}
ctx
->
height
=
AV_RB16
(
buf
+
0x18
);
...
...
@@ -265,10 +267,22 @@ static int dnxhd_decode_macroblock(DNXHDContext *ctx, int x, int y)
for
(
i
=
0
;
i
<
8
;
i
++
)
{
dnxhd_decode_dct_block
(
ctx
,
ctx
->
blocks
[
i
],
i
,
qscale
);
}
if
(
ctx
->
picture
.
interlaced_frame
)
{
dct_linesize_luma
<<=
1
;
dct_linesize_chroma
<<=
1
;
}
dest_y
=
ctx
->
picture
.
data
[
0
]
+
((
y
*
dct_linesize_luma
)
<<
4
)
+
(
x
<<
4
);
dest_u
=
ctx
->
picture
.
data
[
1
]
+
((
y
*
dct_linesize_chroma
)
<<
4
)
+
(
x
<<
3
);
dest_v
=
ctx
->
picture
.
data
[
2
]
+
((
y
*
dct_linesize_chroma
)
<<
4
)
+
(
x
<<
3
);
if
(
ctx
->
cur_field
)
{
dest_y
+=
ctx
->
picture
.
linesize
[
0
];
dest_u
+=
ctx
->
picture
.
linesize
[
1
];
dest_v
+=
ctx
->
picture
.
linesize
[
2
];
}
dct_offset
=
dct_linesize_luma
<<
3
;
ctx
->
dsp
.
idct_put
(
dest_y
,
dct_linesize_luma
,
ctx
->
blocks
[
0
]);
ctx
->
dsp
.
idct_put
(
dest_y
+
8
,
dct_linesize_luma
,
ctx
->
blocks
[
1
]);
...
...
@@ -308,10 +322,12 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
{
DNXHDContext
*
ctx
=
avctx
->
priv_data
;
AVFrame
*
picture
=
data
;
int
first_field
=
1
;
dprintf
(
avctx
,
"frame size %d
\n
"
,
buf_size
);
if
(
dnxhd_decode_header
(
ctx
,
buf
,
buf_size
)
<
0
)
decode_coding_unit:
if
(
dnxhd_decode_header
(
ctx
,
buf
,
buf_size
,
first_field
)
<
0
)
return
-
1
;
avctx
->
pix_fmt
=
PIX_FMT_YUV422P
;
...
...
@@ -319,15 +335,24 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
return
-
1
;
avcodec_set_dimensions
(
avctx
,
ctx
->
width
,
ctx
->
height
);
if
(
first_field
)
{
if
(
ctx
->
picture
.
data
[
0
])
avctx
->
release_buffer
(
avctx
,
&
ctx
->
picture
);
if
(
avctx
->
get_buffer
(
avctx
,
&
ctx
->
picture
)
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
-
1
;
}
}
dnxhd_decode_macroblocks
(
ctx
,
buf
+
0x280
,
buf_size
-
0x280
);
if
(
first_field
&&
ctx
->
picture
.
interlaced_frame
)
{
buf
+=
ctx
->
cid_table
->
coding_unit_size
;
buf_size
-=
ctx
->
cid_table
->
coding_unit_size
;
first_field
=
0
;
goto
decode_coding_unit
;
}
*
picture
=
ctx
->
picture
;
*
data_size
=
sizeof
(
AVPicture
);
return
buf_size
;
...
...
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