1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 15:27:34 +00:00

AK: Remove try_ prefix from FixedArray creation functions

This commit is contained in:
Linus Groh 2023-01-28 20:12:17 +00:00 committed by Jelle Raaijmakers
parent 909c2a73c4
commit 9c08bb9555
26 changed files with 57 additions and 59 deletions

View file

@ -143,9 +143,9 @@ private:
static ErrorOr<NonZeroTokens> create_non_zero_tokens(u32 size_in_sub_blocks, bool subsampling)
{
return NonZeroTokens {
TRY(FixedArray<bool>::try_create(size_in_sub_blocks)),
TRY(FixedArray<bool>::try_create(size_in_sub_blocks >>= subsampling)),
TRY(FixedArray<bool>::try_create(size_in_sub_blocks)),
TRY(FixedArray<bool>::create(size_in_sub_blocks)),
TRY(FixedArray<bool>::create(size_in_sub_blocks >>= subsampling)),
TRY(FixedArray<bool>::create(size_in_sub_blocks)),
};
}
@ -191,9 +191,9 @@ public:
above_partition_context,
above_non_zero_tokens,
above_segmentation_ids,
TRY(PartitionContext::try_create(superblocks_to_blocks(blocks_ceiled_to_superblocks(height)))),
TRY(PartitionContext::create(superblocks_to_blocks(blocks_ceiled_to_superblocks(height)))),
TRY(create_non_zero_tokens(blocks_to_sub_blocks(height), frame_context.color_config.subsampling_y)),
TRY(SegmentationPredictionContext::try_create(height)),
TRY(SegmentationPredictionContext::create(height)),
};
}

View file

@ -153,9 +153,9 @@ DecoderErrorOr<void> Decoder::create_video_frame(FrameContext const& frame_conte
output_y_size.height() >> frame_context.color_config.subsampling_y,
};
Array<FixedArray<u16>, 3> output_buffers = {
DECODER_TRY_ALLOC(FixedArray<u16>::try_create(output_y_size.width() * output_y_size.height())),
DECODER_TRY_ALLOC(FixedArray<u16>::try_create(output_uv_size.width() * output_uv_size.height())),
DECODER_TRY_ALLOC(FixedArray<u16>::try_create(output_uv_size.width() * output_uv_size.height())),
DECODER_TRY_ALLOC(FixedArray<u16>::create(output_y_size.width() * output_y_size.height())),
DECODER_TRY_ALLOC(FixedArray<u16>::create(output_uv_size.width() * output_uv_size.height())),
DECODER_TRY_ALLOC(FixedArray<u16>::create(output_uv_size.width() * output_uv_size.height())),
};
for (u8 plane = 0; plane < 3; plane++) {
auto& buffer = output_buffers[plane];

View file

@ -858,9 +858,9 @@ DecoderErrorOr<void> Parser::decode_tiles(FrameContext& frame_context)
auto tile_cols = 1 << log2_dimensions.width();
auto tile_rows = 1 << log2_dimensions.height();
PartitionContext above_partition_context = DECODER_TRY_ALLOC(PartitionContext::try_create(superblocks_to_blocks(frame_context.superblock_columns())));
PartitionContext above_partition_context = DECODER_TRY_ALLOC(PartitionContext::create(superblocks_to_blocks(frame_context.superblock_columns())));
NonZeroTokens above_non_zero_tokens = DECODER_TRY_ALLOC(create_non_zero_tokens(blocks_to_sub_blocks(frame_context.columns()), frame_context.color_config.subsampling_x));
SegmentationPredictionContext above_segmentation_ids = DECODER_TRY_ALLOC(SegmentationPredictionContext::try_create(frame_context.columns()));
SegmentationPredictionContext above_segmentation_ids = DECODER_TRY_ALLOC(SegmentationPredictionContext::create(frame_context.columns()));
// FIXME: To implement tiled decoding, we'll need to pre-parse the tile positions and sizes into a 2D vector of ReadonlyBytes,
// then run through each column of tiles in top to bottom order afterward. Each column can be sent to a worker thread

View file

@ -18,9 +18,9 @@ ErrorOr<NonnullOwnPtr<SubsampledYUVFrame>> SubsampledYUVFrame::try_create(
bool subsampling_horizontal, bool subsampling_vertical,
Span<u16> plane_y, Span<u16> plane_u, Span<u16> plane_v)
{
auto plane_y_array = TRY(FixedArray<u16>::try_create(plane_y));
auto plane_u_array = TRY(FixedArray<u16>::try_create(plane_u));
auto plane_v_array = TRY(FixedArray<u16>::try_create(plane_v));
auto plane_y_array = TRY(FixedArray<u16>::create(plane_y));
auto plane_u_array = TRY(FixedArray<u16>::create(plane_u));
auto plane_v_array = TRY(FixedArray<u16>::create(plane_v));
return adopt_nonnull_own_or_enomem(new (nothrow) SubsampledYUVFrame(size, bit_depth, cicp, subsampling_horizontal, subsampling_vertical, plane_y_array, plane_u_array, plane_v_array));
}
@ -28,8 +28,8 @@ DecoderErrorOr<void> SubsampledYUVFrame::output_to_bitmap(Gfx::Bitmap& bitmap)
{
size_t width = this->width();
size_t height = this->height();
auto u_sample_row = DECODER_TRY_ALLOC(FixedArray<u16>::try_create(width));
auto v_sample_row = DECODER_TRY_ALLOC(FixedArray<u16>::try_create(width));
auto u_sample_row = DECODER_TRY_ALLOC(FixedArray<u16>::create(width));
auto v_sample_row = DECODER_TRY_ALLOC(FixedArray<u16>::create(width));
size_t uv_width = width >> m_subsampling_horizontal;
auto converter = TRY(ColorConverter::create(bit_depth(), cicp()));