Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
29f6c9b0
Unverified
Commit
29f6c9b0
authored
Oct 16, 2023
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/h264: keep track of which frames used gray references
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
e4337606
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
2 deletions
+26
-2
h264_picture.c
libavcodec/h264_picture.c
+1
-0
h264_slice.c
libavcodec/h264_slice.c
+20
-2
h264dec.c
libavcodec/h264dec.c
+1
-0
h264dec.h
libavcodec/h264dec.h
+4
-0
No files found.
libavcodec/h264_picture.c
View file @
29f6c9b0
...
...
@@ -96,6 +96,7 @@ static void h264_copy_picture_params(H264Picture *dst, const H264Picture *src)
dst
->
field_picture
=
src
->
field_picture
;
dst
->
reference
=
src
->
reference
;
dst
->
recovered
=
src
->
recovered
;
dst
->
gray
=
src
->
gray
;
dst
->
invalid_gap
=
src
->
invalid_gap
;
dst
->
sei_recovery_frame_cnt
=
src
->
sei_recovery_frame_cnt
;
dst
->
mb_width
=
src
->
mb_width
;
...
...
libavcodec/h264_slice.c
View file @
29f6c9b0
...
...
@@ -457,6 +457,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
h
->
poc
.
prev_frame_num
=
h
->
poc
.
frame_num
;
h
->
recovery_frame
=
h1
->
recovery_frame
;
h
->
non_gray
=
h1
->
non_gray
;
return
err
;
}
...
...
@@ -1544,11 +1545,15 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
if
(
ret
<
0
)
return
ret
;
h
->
short_ref
[
0
]
->
poc
=
prev
->
poc
+
2U
;
h
->
short_ref
[
0
]
->
gray
=
prev
->
gray
;
ff_thread_report_progress
(
&
h
->
short_ref
[
0
]
->
tf
,
INT_MAX
,
0
);
if
(
h
->
short_ref
[
0
]
->
field_picture
)
ff_thread_report_progress
(
&
h
->
short_ref
[
0
]
->
tf
,
INT_MAX
,
1
);
}
else
if
(
!
h
->
frame_recovered
&&
!
h
->
avctx
->
hwaccel
)
color_frame
(
h
->
short_ref
[
0
]
->
f
,
c
);
}
else
if
(
!
h
->
frame_recovered
)
{
if
(
!
h
->
avctx
->
hwaccel
)
color_frame
(
h
->
short_ref
[
0
]
->
f
,
c
);
h
->
short_ref
[
0
]
->
gray
=
1
;
}
h
->
short_ref
[
0
]
->
frame_num
=
h
->
poc
.
prev_frame_num
;
}
}
...
...
@@ -2007,6 +2012,19 @@ static int h264_slice_init(H264Context *h, H264SliceContext *sl,
(
sl
->
ref_list
[
j
][
i
].
reference
&
3
);
}
if
(
sl
->
slice_type_nos
==
AV_PICTURE_TYPE_I
)
{
h
->
cur_pic_ptr
->
gray
=
0
;
h
->
non_gray
=
1
;
}
else
{
int
gray
=
0
;
for
(
j
=
0
;
j
<
sl
->
list_count
;
j
++
)
{
for
(
i
=
0
;
i
<
sl
->
ref_count
[
j
];
i
++
)
{
gray
|=
sl
->
ref_list
[
j
][
i
].
parent
->
gray
;
}
}
h
->
cur_pic_ptr
->
gray
=
gray
;
}
if
(
h
->
avctx
->
debug
&
FF_DEBUG_PICT_INFO
)
{
av_log
(
h
->
avctx
,
AV_LOG_DEBUG
,
"slice:%d %c mb:%d %c%s%s frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s
\n
"
,
...
...
libavcodec/h264dec.c
View file @
29f6c9b0
...
...
@@ -492,6 +492,7 @@ static void h264_decode_flush(AVCodecContext *avctx)
ff_h264_unref_picture
(
&
h
->
cur_pic
);
h
->
mb_y
=
0
;
h
->
non_gray
=
0
;
ff_h264_free_tables
(
h
);
h
->
context_initialized
=
0
;
...
...
libavcodec/h264dec.h
View file @
29f6c9b0
...
...
@@ -154,6 +154,8 @@ typedef struct H264Picture {
/// RefStruct reference; its pointee is shared between decoding threads.
atomic_int
*
decode_error_flags
;
int
gray
;
}
H264Picture
;
typedef
struct
H264Ref
{
...
...
@@ -567,6 +569,8 @@ typedef struct H264Context {
struct
FFRefStructPool
*
ref_index_pool
;
struct
FFRefStructPool
*
decode_error_flags_pool
;
int
ref2frm
[
MAX_SLICES
][
2
][
64
];
///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1
int
non_gray
;
///< Did we encounter a intra frame after a gray gap frame
}
H264Context
;
extern
const
uint16_t
ff_h264_mb_sizes
[
4
];
...
...
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