Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
89ef08c9
Commit
89ef08c9
authored
Mar 28, 2014
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DNxHD: K&R formatting cosmetics
parent
a7448064
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
28 deletions
+37
-28
dnxhd_parser.c
libavcodec/dnxhd_parser.c
+5
-5
dnxhddata.c
libavcodec/dnxhddata.c
+1
-1
dnxhddec.c
libavcodec/dnxhddec.c
+31
-22
dnxhdenc.c
libavcodec/dnxhdenc.c
+0
-0
No files found.
libavcodec/dnxhd_parser.c
View file @
89ef08c9
...
...
@@ -37,7 +37,7 @@ static int dnxhd_find_frame_end(ParseContext *pc,
if
(
!
pic_found
)
{
for
(
i
=
0
;
i
<
buf_size
;
i
++
)
{
state
=
(
state
<<
8
)
|
buf
[
i
];
state
=
(
state
<<
8
)
|
buf
[
i
];
if
((
state
&
0xffffffffffLL
)
==
DNXHD_HEADER_PREFIX
)
{
i
++
;
pic_found
=
1
;
...
...
@@ -50,11 +50,11 @@ static int dnxhd_find_frame_end(ParseContext *pc,
if
(
!
buf_size
)
/* EOF considered as end of frame */
return
0
;
for
(;
i
<
buf_size
;
i
++
)
{
state
=
(
state
<<
8
)
|
buf
[
i
];
state
=
(
state
<<
8
)
|
buf
[
i
];
if
((
state
&
0xffffffffffLL
)
==
DNXHD_HEADER_PREFIX
)
{
pc
->
frame_start_found
=
0
;
pc
->
state64
=
-
1
;
return
i
-
4
;
return
i
-
4
;
}
}
}
...
...
@@ -76,12 +76,12 @@ static int dnxhd_parse(AVCodecParserContext *s,
}
else
{
next
=
dnxhd_find_frame_end
(
pc
,
buf
,
buf_size
);
if
(
ff_combine_frame
(
pc
,
next
,
&
buf
,
&
buf_size
)
<
0
)
{
*
poutbuf
=
NULL
;
*
poutbuf
=
NULL
;
*
poutbuf_size
=
0
;
return
buf_size
;
}
}
*
poutbuf
=
buf
;
*
poutbuf
=
buf
;
*
poutbuf_size
=
buf_size
;
return
next
;
}
...
...
libavcodec/dnxhddata.c
View file @
89ef08c9
...
...
@@ -1165,7 +1165,7 @@ int ff_dnxhd_get_cid_table(int cid)
int
ff_dnxhd_find_cid
(
AVCodecContext
*
avctx
,
int
bit_depth
)
{
int
i
,
j
;
int
mbs
=
avctx
->
bit_rate
/
1000000
;
int
mbs
=
avctx
->
bit_rate
/
1000000
;
if
(
!
mbs
)
return
0
;
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
ff_dnxhd_cid_table
);
i
++
)
{
...
...
libavcodec/dnxhddec.c
View file @
89ef08c9
...
...
@@ -53,9 +53,12 @@ typedef struct DNXHDContext {
#define DNXHD_VLC_BITS 9
#define DNXHD_DC_VLC_BITS 7
static
void
dnxhd_decode_dct_block_8
(
DNXHDContext
*
ctx
,
int16_t
*
block
,
int
n
,
int
qscale
);
static
void
dnxhd_decode_dct_block_10
(
DNXHDContext
*
ctx
,
int16_t
*
block
,
int
n
,
int
qscale
);
static
void
dnxhd_decode_dct_block_10_444
(
DNXHDContext
*
ctx
,
int16_t
*
block
,
int
n
,
int
qscale
);
static
void
dnxhd_decode_dct_block_8
(
DNXHDContext
*
ctx
,
int16_t
*
block
,
int
n
,
int
qscale
);
static
void
dnxhd_decode_dct_block_10
(
DNXHDContext
*
ctx
,
int16_t
*
block
,
int
n
,
int
qscale
);
static
void
dnxhd_decode_dct_block_10_444
(
DNXHDContext
*
ctx
,
int16_t
*
block
,
int
n
,
int
qscale
);
static
av_cold
int
dnxhd_decode_init
(
AVCodecContext
*
avctx
)
{
...
...
@@ -90,14 +93,16 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, int cid)
ctx
->
cid_table
->
run_bits
,
1
,
1
,
ctx
->
cid_table
->
run_codes
,
2
,
2
,
0
);
ff_init_scantable
(
ctx
->
dsp
.
idct_permutation
,
&
ctx
->
scantable
,
ff_zigzag_direct
);
ff_init_scantable
(
ctx
->
dsp
.
idct_permutation
,
&
ctx
->
scantable
,
ff_zigzag_direct
);
ctx
->
cid
=
cid
;
}
return
0
;
}
static
int
dnxhd_decode_header
(
DNXHDContext
*
ctx
,
AVFrame
*
frame
,
const
uint8_t
*
buf
,
int
buf_size
,
int
first_field
)
const
uint8_t
*
buf
,
int
buf_size
,
int
first_field
)
{
static
const
uint8_t
header_prefix
[]
=
{
0x00
,
0x00
,
0x02
,
0x80
,
0x01
};
static
const
uint8_t
header_prefix444
[]
=
{
0x00
,
0x00
,
0x02
,
0x80
,
0x02
};
...
...
@@ -114,7 +119,8 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
ctx
->
cur_field
=
buf
[
5
]
&
1
;
frame
->
interlaced_frame
=
1
;
frame
->
top_field_first
=
first_field
^
ctx
->
cur_field
;
av_log
(
ctx
->
avctx
,
AV_LOG_DEBUG
,
"interlaced %d, cur field %d
\n
"
,
buf
[
5
]
&
3
,
ctx
->
cur_field
);
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
);
...
...
@@ -161,22 +167,24 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
return
AVERROR_INVALIDDATA
;
}
ctx
->
mb_width
=
ctx
->
width
>>
4
;
ctx
->
mb_width
=
ctx
->
width
>>
4
;
ctx
->
mb_height
=
buf
[
0x16d
];
av_dlog
(
ctx
->
avctx
,
"mb width %d, mb height %d
\n
"
,
ctx
->
mb_width
,
ctx
->
mb_height
);
av_dlog
(
ctx
->
avctx
,
"mb width %d, mb height %d
\n
"
,
ctx
->
mb_width
,
ctx
->
mb_height
);
if
((
ctx
->
height
+
15
)
>>
4
==
ctx
->
mb_height
&&
frame
->
interlaced_frame
)
if
((
ctx
->
height
+
15
)
>>
4
==
ctx
->
mb_height
&&
frame
->
interlaced_frame
)
ctx
->
height
<<=
1
;
if
(
ctx
->
mb_height
>
68
||
(
ctx
->
mb_height
<<
frame
->
interlaced_frame
)
>
(
ctx
->
height
+
15
)
>>
4
)
{
av_log
(
ctx
->
avctx
,
AV_LOG_ERROR
,
"mb height too big: %d
\n
"
,
ctx
->
mb_height
);
(
ctx
->
mb_height
<<
frame
->
interlaced_frame
)
>
(
ctx
->
height
+
15
)
>>
4
)
{
av_log
(
ctx
->
avctx
,
AV_LOG_ERROR
,
"mb height too big: %d
\n
"
,
ctx
->
mb_height
);
return
AVERROR_INVALIDDATA
;
}
for
(
i
=
0
;
i
<
ctx
->
mb_height
;
i
++
)
{
ctx
->
mb_scan_index
[
i
]
=
AV_RB32
(
buf
+
0x170
+
(
i
<<
2
));
ctx
->
mb_scan_index
[
i
]
=
AV_RB32
(
buf
+
0x170
+
(
i
<<
2
));
av_dlog
(
ctx
->
avctx
,
"mb scan index %d
\n
"
,
ctx
->
mb_scan_index
[
i
]);
if
(
buf_size
<
ctx
->
mb_scan_index
[
i
]
+
0x280
)
{
av_log
(
ctx
->
avctx
,
AV_LOG_ERROR
,
"invalid mb scan index
\n
"
);
...
...
@@ -200,11 +208,11 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
OPEN_READER
(
bs
,
&
ctx
->
gb
);
if
(
!
ctx
->
is_444
)
{
if
(
n
&
2
)
{
component
=
1
+
(
n
&
1
);
if
(
n
&
2
)
{
component
=
1
+
(
n
&
1
);
weight_matrix
=
ctx
->
cid_table
->
chroma_weight
;
}
else
{
component
=
0
;
component
=
0
;
weight_matrix
=
ctx
->
cid_table
->
luma_weight
;
}
}
else
{
...
...
@@ -255,13 +263,13 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
break
;
}
j
=
ctx
->
scantable
.
permutated
[
i
];
level
=
(
2
*
level
+
1
)
*
qscale
*
weight_matrix
[
i
];
j
=
ctx
->
scantable
.
permutated
[
i
];
level
=
(
2
*
level
+
1
)
*
qscale
*
weight_matrix
[
i
];
if
(
level_bias
<
32
||
weight_matrix
[
i
]
!=
level_bias
)
level
+=
level_bias
;
level
>>=
level_shift
;
block
[
j
]
=
(
level
^
sign
)
-
sign
;
block
[
j
]
=
(
level
^
sign
)
-
sign
;
}
CLOSE_READER
(
bs
,
&
ctx
->
gb
);
...
...
@@ -285,7 +293,8 @@ static void dnxhd_decode_dct_block_10_444(DNXHDContext *ctx, int16_t *block,
dnxhd_decode_dct_block
(
ctx
,
block
,
n
,
qscale
,
6
,
32
,
6
);
}
static
int
dnxhd_decode_macroblock
(
DNXHDContext
*
ctx
,
AVFrame
*
frame
,
int
x
,
int
y
)
static
int
dnxhd_decode_macroblock
(
DNXHDContext
*
ctx
,
AVFrame
*
frame
,
int
x
,
int
y
)
{
int
shift1
=
ctx
->
bit_depth
==
10
;
int
dct_linesize_luma
=
frame
->
linesize
[
0
];
...
...
@@ -378,8 +387,8 @@ static int dnxhd_decode_macroblocks(DNXHDContext *ctx, AVFrame *frame,
return
0
;
}
static
int
dnxhd_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame
,
AVPacket
*
avpkt
)
static
int
dnxhd_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame
,
AVPacket
*
avpkt
)
{
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
...
...
@@ -390,7 +399,7 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
av_dlog
(
avctx
,
"frame size %d
\n
"
,
buf_size
);
decode_coding_unit:
decode_coding_unit:
if
((
ret
=
dnxhd_decode_header
(
ctx
,
picture
,
buf
,
buf_size
,
first_field
))
<
0
)
return
ret
;
...
...
libavcodec/dnxhdenc.c
View file @
89ef08c9
This diff is collapsed.
Click to expand it.
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