Commit c04c1750 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu/vaapi/AV1VaapiVideoDecoderDelegate: Implement FillSegmentInfo()

Bug: 1000988
Test: video_decode_accelerator_tests
Change-Id: I63c824468b53114a8be081a28d2297de7af67417
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2440726
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarAndres Calderon Jaramillo <andrescj@chromium.org>
Reviewed-by: default avatarSreerenj Balachandran <sreerenj.balachandran@intel.com>
Cr-Commit-Position: refs/heads/master@{#827597}
parent 96c1bd2d
...@@ -20,6 +20,42 @@ ...@@ -20,6 +20,42 @@
namespace media { namespace media {
namespace { namespace {
#define ARRAY_SIZE(ar) (sizeof(ar) / sizeof(ar[0]))
void FillSegmentInfo(VASegmentationStructAV1& va_seg_info,
const libgav1::Segmentation& segmentation) {
auto& va_seg_info_fields = va_seg_info.segment_info_fields.bits;
va_seg_info_fields.enabled = segmentation.enabled;
va_seg_info_fields.update_map = segmentation.update_map;
va_seg_info_fields.temporal_update = segmentation.temporal_update;
va_seg_info_fields.update_data = segmentation.update_data;
static_assert(libgav1::kMaxSegments == 8 && libgav1::kSegmentFeatureMax == 8,
"Invalid Segment array size");
static_assert(ARRAY_SIZE(segmentation.feature_data) == 8 &&
ARRAY_SIZE(segmentation.feature_data[0]) == 8 &&
ARRAY_SIZE(segmentation.feature_enabled) == 8 &&
ARRAY_SIZE(segmentation.feature_enabled[0]) == 8,
"Invalid segmentation array size");
static_assert(ARRAY_SIZE(va_seg_info.feature_data) == 8 &&
ARRAY_SIZE(va_seg_info.feature_data[0]) == 8 &&
ARRAY_SIZE(va_seg_info.feature_mask) == 8,
"Invalid feature array size");
for (size_t i = 0; i < libgav1::kMaxSegments; ++i) {
for (size_t j = 0; j < libgav1::kSegmentFeatureMax; ++j)
va_seg_info.feature_data[i][j] = segmentation.feature_data[i][j];
}
for (size_t i = 0; i < libgav1::kMaxSegments; ++i) {
uint8_t feature_mask = 0;
for (size_t j = 0; j < libgav1::kSegmentFeatureMax; ++j) {
if (segmentation.feature_enabled[i][j])
feature_mask |= 1 << j;
}
va_seg_info.feature_mask[i] = feature_mask;
}
}
bool FillAV1PictureParameter(const AV1Picture& pic, bool FillAV1PictureParameter(const AV1Picture& pic,
const libgav1::ObuSequenceHeader& seq_header, const libgav1::ObuSequenceHeader& seq_header,
const AV1ReferenceFrameVector& ref_frames, const AV1ReferenceFrameVector& ref_frames,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment