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
f8c507f4
Commit
f8c507f4
authored
Feb 13, 2014
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264: Refactor ff_h264_decode_ref_pic_list_reordering
In preparation for MVC support.
parent
73eca738
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
64 deletions
+72
-64
h264_refs.c
libavcodec/h264_refs.c
+72
-64
No files found.
libavcodec/h264_refs.c
View file @
f8c507f4
...
@@ -237,75 +237,83 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h)
...
@@ -237,75 +237,83 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h)
return
-
1
;
return
-
1
;
}
}
if
(
reordering_of_pic_nums_idc
<
3
)
{
switch
(
reordering_of_pic_nums_idc
)
{
if
(
reordering_of_pic_nums_idc
<
2
)
{
case
0
:
const
unsigned
int
abs_diff_pic_num
=
get_ue_golomb
(
&
h
->
gb
)
+
1
;
case
1
:
{
int
frame_num
;
const
unsigned
int
abs_diff_pic_num
=
get_ue_golomb
(
&
h
->
gb
)
+
1
;
int
frame_num
;
if
(
abs_diff_pic_num
>
h
->
max_pic_num
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"abs_diff_pic_num overflow
\n
"
);
if
(
abs_diff_pic_num
>
h
->
max_pic_num
)
{
return
-
1
;
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
}
"abs_diff_pic_num overflow
\n
"
);
return
AVERROR_INVALIDDATA
;
if
(
reordering_of_pic_nums_idc
==
0
)
}
pred
-=
abs_diff_pic_num
;
else
if
(
reordering_of_pic_nums_idc
==
0
)
pred
+=
abs_diff_pic_num
;
pred
-=
abs_diff_pic_num
;
pred
&=
h
->
max_pic_num
-
1
;
else
pred
+=
abs_diff_pic_num
;
frame_num
=
pic_num_extract
(
h
,
pred
,
&
pic_structure
);
pred
&=
h
->
max_pic_num
-
1
;
for
(
i
=
h
->
short_ref_count
-
1
;
i
>=
0
;
i
--
)
{
frame_num
=
pic_num_extract
(
h
,
pred
,
&
pic_structure
);
ref
=
h
->
short_ref
[
i
];
assert
(
ref
->
reference
);
for
(
i
=
h
->
short_ref_count
-
1
;
i
>=
0
;
i
--
)
{
assert
(
!
ref
->
long_ref
);
ref
=
h
->
short_ref
[
i
];
if
(
ref
->
frame_num
==
frame_num
&&
assert
(
ref
->
reference
);
(
ref
->
reference
&
pic_structure
))
assert
(
!
ref
->
long_ref
);
break
;
if
(
ref
->
frame_num
==
frame_num
&&
}
(
ref
->
reference
&
pic_structure
))
if
(
i
>=
0
)
break
;
ref
->
pic_id
=
pred
;
}
else
{
int
long_idx
;
pic_id
=
get_ue_golomb
(
&
h
->
gb
);
//long_term_pic_idx
long_idx
=
pic_num_extract
(
h
,
pic_id
,
&
pic_structure
);
if
(
long_idx
>
31
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"long_term_pic_idx overflow
\n
"
);
return
-
1
;
}
ref
=
h
->
long_ref
[
long_idx
];
assert
(
!
(
ref
&&
!
ref
->
reference
));
if
(
ref
&&
(
ref
->
reference
&
pic_structure
))
{
ref
->
pic_id
=
pic_id
;
assert
(
ref
->
long_ref
);
i
=
0
;
}
else
{
i
=
-
1
;
}
}
}
if
(
i
>=
0
)
ref
->
pic_id
=
pred
;
break
;
}
case
2
:
{
int
long_idx
;
pic_id
=
get_ue_golomb
(
&
h
->
gb
);
// long_term_pic_idx
long_idx
=
pic_num_extract
(
h
,
pic_id
,
&
pic_structure
);
if
(
i
<
0
)
{
if
(
long_idx
>
31
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"reference picture missing during reorder
\n
"
);
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
memset
(
&
h
->
ref_list
[
list
][
index
],
0
,
sizeof
(
Picture
));
//FIXME
"long_term_pic_idx overflow
\n
"
);
return
AVERROR_INVALIDDATA
;
}
ref
=
h
->
long_ref
[
long_idx
];
assert
(
!
(
ref
&&
!
ref
->
reference
));
if
(
ref
&&
(
ref
->
reference
&
pic_structure
))
{
ref
->
pic_id
=
pic_id
;
assert
(
ref
->
long_ref
);
i
=
0
;
}
else
{
}
else
{
for
(
i
=
index
;
i
+
1
<
h
->
ref_count
[
list
];
i
++
)
{
i
=
-
1
;
if
(
ref
->
long_ref
==
h
->
ref_list
[
list
][
i
].
long_ref
&&
ref
->
pic_id
==
h
->
ref_list
[
list
][
i
].
pic_id
)
break
;
}
for
(;
i
>
index
;
i
--
)
{
COPY_PICTURE
(
&
h
->
ref_list
[
list
][
i
],
&
h
->
ref_list
[
list
][
i
-
1
]);
}
COPY_PICTURE
(
&
h
->
ref_list
[
list
][
index
],
ref
);
if
(
FIELD_PICTURE
(
h
))
{
pic_as_field
(
&
h
->
ref_list
[
list
][
index
],
pic_structure
);
}
}
}
break
;
}
default:
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"illegal reordering_of_pic_nums_idc
\n
"
);
return
AVERROR_INVALIDDATA
;
}
if
(
i
<
0
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"reference picture missing during reorder
\n
"
);
memset
(
&
h
->
ref_list
[
list
][
index
],
0
,
sizeof
(
Picture
));
// FIXME
}
else
{
}
else
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"illegal reordering_of_pic_nums_idc
\n
"
);
for
(
i
=
index
;
i
+
1
<
h
->
ref_count
[
list
];
i
++
)
{
return
-
1
;
if
(
ref
->
long_ref
==
h
->
ref_list
[
list
][
i
].
long_ref
&&
ref
->
pic_id
==
h
->
ref_list
[
list
][
i
].
pic_id
)
break
;
}
for
(;
i
>
index
;
i
--
)
{
COPY_PICTURE
(
&
h
->
ref_list
[
list
][
i
],
&
h
->
ref_list
[
list
][
i
-
1
]);
}
COPY_PICTURE
(
&
h
->
ref_list
[
list
][
index
],
ref
);
if
(
FIELD_PICTURE
(
h
))
{
pic_as_field
(
&
h
->
ref_list
[
list
][
index
],
pic_structure
);
}
}
}
}
}
}
}
...
...
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