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
ec440339
Commit
ec440339
authored
Oct 30, 2018
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/cbs_vp9: keep track of reference frames
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
edcdf351
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
4 deletions
+72
-4
cbs_vp9.h
libavcodec/cbs_vp9.h
+16
-0
cbs_vp9_syntax_template.c
libavcodec/cbs_vp9_syntax_template.c
+56
-4
No files found.
libavcodec/cbs_vp9.h
View file @
ec440339
...
@@ -181,6 +181,13 @@ typedef struct VP9RawSuperframe {
...
@@ -181,6 +181,13 @@ typedef struct VP9RawSuperframe {
VP9RawSuperframeIndex
index
;
VP9RawSuperframeIndex
index
;
}
VP9RawSuperframe
;
}
VP9RawSuperframe
;
typedef
struct
VP9ReferenceFrameState
{
int
frame_width
;
// RefFrameWidth
int
frame_height
;
// RefFrameHeight
int
subsampling_x
;
// RefSubsamplingX
int
subsampling_y
;
// RefSubsamplingY
int
bit_depth
;
// RefBitDepth
}
VP9ReferenceFrameState
;
typedef
struct
CodedBitstreamVP9Context
{
typedef
struct
CodedBitstreamVP9Context
{
// Frame dimensions in 8x8 mode info blocks.
// Frame dimensions in 8x8 mode info blocks.
...
@@ -190,6 +197,15 @@ typedef struct CodedBitstreamVP9Context {
...
@@ -190,6 +197,15 @@ typedef struct CodedBitstreamVP9Context {
uint16_t
sb64_cols
;
uint16_t
sb64_cols
;
uint16_t
sb64_rows
;
uint16_t
sb64_rows
;
int
frame_width
;
int
frame_height
;
uint8_t
subsampling_x
;
uint8_t
subsampling_y
;
int
bit_depth
;
VP9ReferenceFrameState
ref
[
VP9_NUM_REF_FRAMES
];
// Write buffer.
// Write buffer.
uint8_t
*
write_buffer
;
uint8_t
*
write_buffer
;
size_t
write_buffer_size
;
size_t
write_buffer_size
;
...
...
libavcodec/cbs_vp9_syntax_template.c
View file @
ec440339
...
@@ -43,10 +43,14 @@ static int FUNC(frame_sync_code)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -43,10 +43,14 @@ static int FUNC(frame_sync_code)(CodedBitstreamContext *ctx, RWContext *rw,
static
int
FUNC
(
color_config
)(
CodedBitstreamContext
*
ctx
,
RWContext
*
rw
,
static
int
FUNC
(
color_config
)(
CodedBitstreamContext
*
ctx
,
RWContext
*
rw
,
VP9RawFrameHeader
*
current
,
int
profile
)
VP9RawFrameHeader
*
current
,
int
profile
)
{
{
CodedBitstreamVP9Context
*
vp9
=
ctx
->
priv_data
;
int
err
;
int
err
;
if
(
profile
>=
2
)
if
(
profile
>=
2
)
{
f
(
1
,
ten_or_twelve_bit
);
f
(
1
,
ten_or_twelve_bit
);
vp9
->
bit_depth
=
current
->
ten_or_twelve_bit
?
12
:
10
;
}
else
vp9
->
bit_depth
=
8
;
f
(
3
,
color_space
);
f
(
3
,
color_space
);
...
@@ -69,6 +73,9 @@ static int FUNC(color_config)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -69,6 +73,9 @@ static int FUNC(color_config)(CodedBitstreamContext *ctx, RWContext *rw,
}
}
}
}
vp9
->
subsampling_x
=
current
->
subsampling_x
;
vp9
->
subsampling_y
=
current
->
subsampling_y
;
return
0
;
return
0
;
}
}
...
@@ -81,8 +88,11 @@ static int FUNC(frame_size)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -81,8 +88,11 @@ static int FUNC(frame_size)(CodedBitstreamContext *ctx, RWContext *rw,
f
(
16
,
frame_width_minus_1
);
f
(
16
,
frame_width_minus_1
);
f
(
16
,
frame_height_minus_1
);
f
(
16
,
frame_height_minus_1
);
vp9
->
mi_cols
=
(
current
->
frame_width_minus_1
+
8
)
>>
3
;
vp9
->
frame_width
=
current
->
frame_width_minus_1
+
1
;
vp9
->
mi_rows
=
(
current
->
frame_height_minus_1
+
8
)
>>
3
;
vp9
->
frame_height
=
current
->
frame_height_minus_1
+
1
;
vp9
->
mi_cols
=
(
vp9
->
frame_width
+
7
)
>>
3
;
vp9
->
mi_rows
=
(
vp9
->
frame_height
+
7
)
>>
3
;
vp9
->
sb64_cols
=
(
vp9
->
mi_cols
+
7
)
>>
3
;
vp9
->
sb64_cols
=
(
vp9
->
mi_cols
+
7
)
>>
3
;
vp9
->
sb64_rows
=
(
vp9
->
mi_rows
+
7
)
>>
3
;
vp9
->
sb64_rows
=
(
vp9
->
mi_rows
+
7
)
>>
3
;
...
@@ -107,15 +117,33 @@ static int FUNC(render_size)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -107,15 +117,33 @@ static int FUNC(render_size)(CodedBitstreamContext *ctx, RWContext *rw,
static
int
FUNC
(
frame_size_with_refs
)(
CodedBitstreamContext
*
ctx
,
RWContext
*
rw
,
static
int
FUNC
(
frame_size_with_refs
)(
CodedBitstreamContext
*
ctx
,
RWContext
*
rw
,
VP9RawFrameHeader
*
current
)
VP9RawFrameHeader
*
current
)
{
{
CodedBitstreamVP9Context
*
vp9
=
ctx
->
priv_data
;
int
err
,
i
;
int
err
,
i
;
for
(
i
=
0
;
i
<
VP9_REFS_PER_FRAME
;
i
++
)
{
for
(
i
=
0
;
i
<
VP9_REFS_PER_FRAME
;
i
++
)
{
fs
(
1
,
found_ref
[
i
],
1
,
i
);
fs
(
1
,
found_ref
[
i
],
1
,
i
);
if
(
current
->
found_ref
[
i
])
if
(
current
->
found_ref
[
i
])
{
VP9ReferenceFrameState
*
ref
=
&
vp9
->
ref
[
current
->
ref_frame_idx
[
i
]];
vp9
->
frame_width
=
ref
->
frame_width
;
vp9
->
frame_height
=
ref
->
frame_height
;
vp9
->
subsampling_x
=
ref
->
subsampling_x
;
vp9
->
subsampling_y
=
ref
->
subsampling_y
;
vp9
->
bit_depth
=
ref
->
bit_depth
;
break
;
break
;
}
}
}
if
(
i
>=
VP9_REFS_PER_FRAME
)
if
(
i
>=
VP9_REFS_PER_FRAME
)
CHECK
(
FUNC
(
frame_size
)(
ctx
,
rw
,
current
));
CHECK
(
FUNC
(
frame_size
)(
ctx
,
rw
,
current
));
else
{
vp9
->
mi_cols
=
(
vp9
->
frame_width
+
7
)
>>
3
;
vp9
->
mi_rows
=
(
vp9
->
frame_height
+
7
)
>>
3
;
vp9
->
sb64_cols
=
(
vp9
->
mi_cols
+
7
)
>>
3
;
vp9
->
sb64_rows
=
(
vp9
->
mi_rows
+
7
)
>>
3
;
}
CHECK
(
FUNC
(
render_size
)(
ctx
,
rw
,
current
));
CHECK
(
FUNC
(
render_size
)(
ctx
,
rw
,
current
));
return
0
;
return
0
;
...
@@ -249,6 +277,7 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -249,6 +277,7 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw,
static
int
FUNC
(
uncompressed_header
)(
CodedBitstreamContext
*
ctx
,
RWContext
*
rw
,
static
int
FUNC
(
uncompressed_header
)(
CodedBitstreamContext
*
ctx
,
RWContext
*
rw
,
VP9RawFrameHeader
*
current
)
VP9RawFrameHeader
*
current
)
{
{
CodedBitstreamVP9Context
*
vp9
=
ctx
->
priv_data
;
int
profile
,
i
;
int
profile
,
i
;
int
err
;
int
err
;
...
@@ -301,6 +330,10 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -301,6 +330,10 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
infer
(
color_space
,
1
);
infer
(
color_space
,
1
);
infer
(
subsampling_x
,
1
);
infer
(
subsampling_x
,
1
);
infer
(
subsampling_y
,
1
);
infer
(
subsampling_y
,
1
);
vp9
->
bit_depth
=
8
;
vp9
->
subsampling_x
=
current
->
subsampling_x
;
vp9
->
subsampling_y
=
current
->
subsampling_y
;
}
}
f
(
8
,
refresh_frame_flags
);
f
(
8
,
refresh_frame_flags
);
...
@@ -339,6 +372,25 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
...
@@ -339,6 +372,25 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
f
(
16
,
header_size_in_bytes
);
f
(
16
,
header_size_in_bytes
);
for
(
i
=
0
;
i
<
VP9_NUM_REF_FRAMES
;
i
++
)
{
if
(
current
->
refresh_frame_flags
&
(
1
<<
i
))
{
vp9
->
ref
[
i
]
=
(
VP9ReferenceFrameState
)
{
.
frame_width
=
vp9
->
frame_width
,
.
frame_height
=
vp9
->
frame_height
,
.
subsampling_x
=
vp9
->
subsampling_x
,
.
subsampling_y
=
vp9
->
subsampling_y
,
.
bit_depth
=
vp9
->
bit_depth
,
};
}
}
av_log
(
ctx
->
log_ctx
,
AV_LOG_DEBUG
,
"Frame: size %dx%d "
"subsample %dx%d bit_depth %d tiles %dx%d.
\n
"
,
vp9
->
frame_width
,
vp9
->
frame_height
,
vp9
->
subsampling_x
,
vp9
->
subsampling_y
,
vp9
->
bit_depth
,
1
<<
current
->
tile_cols_log2
,
1
<<
current
->
tile_rows_log2
);
return
0
;
return
0
;
}
}
...
...
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