d3d12: Fix warning C4244 'argument' : conversion from 'type1' to 'type2', possible loss of data
Reviewed-By: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Jesse Natalie <None> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32979>
This commit is contained in:
@@ -329,7 +329,7 @@ create_tmp_resource(struct pipe_screen *screen,
|
||||
{
|
||||
struct pipe_resource tpl = {};
|
||||
tpl.width0 = info->dst.box.width;
|
||||
tpl.height0 = info->dst.box.height;
|
||||
tpl.height0 = static_cast<uint16_t>(info->dst.box.height);
|
||||
tpl.depth0 = info->dst.box.depth;
|
||||
tpl.array_size = 1;
|
||||
tpl.format = PIPE_FORMAT_R8_UINT;
|
||||
|
||||
@@ -333,8 +333,8 @@ d3d12_bufmgr_create_buffer(struct pb_manager *pmgr,
|
||||
return NULL;
|
||||
|
||||
pipe_reference_init(&buf->base.base.reference, 1);
|
||||
buf->base.base.alignment_log2 = util_logbase2(pb_desc->alignment);
|
||||
buf->base.base.usage = pb_desc->usage;
|
||||
buf->base.base.alignment_log2 = static_cast<uint8_t>(util_logbase2(pb_desc->alignment));
|
||||
buf->base.base.usage = static_cast<uint16_t>(pb_desc->usage);
|
||||
buf->base.vtbl = &d3d12_buffer_vtbl;
|
||||
buf->base.base.size = size;
|
||||
buf->range.Begin = 0;
|
||||
|
||||
@@ -41,7 +41,7 @@ enum d3d12_residency_status {
|
||||
d3d12_permanently_resident,
|
||||
};
|
||||
|
||||
enum batch_bo_reference_state {
|
||||
enum batch_bo_reference_state : uint8_t {
|
||||
batch_bo_reference_none = 0,
|
||||
batch_bo_reference_read = (1 << 0),
|
||||
batch_bo_reference_written = (1 << 1),
|
||||
|
||||
@@ -800,8 +800,8 @@ d3d12_shader_key_hash(const d3d12_shader_key *key)
|
||||
|
||||
hash = (uint32_t)key->stage;
|
||||
|
||||
hash += key->next_varying_inputs;
|
||||
hash += key->prev_varying_outputs;
|
||||
hash += static_cast<uint32_t>(key->next_varying_inputs);
|
||||
hash += static_cast<uint32_t>(key->prev_varying_outputs);
|
||||
hash += key->common_all;
|
||||
if (key->next_has_frac_inputs)
|
||||
hash = _mesa_hash_data_with_seed(key->next_varying_frac_inputs, sizeof(d3d12_shader_selector::varying_frac_inputs), hash);
|
||||
@@ -814,7 +814,7 @@ d3d12_shader_key_hash(const d3d12_shader_key *key)
|
||||
* hashing for now until this is shown to be worthwhile. */
|
||||
break;
|
||||
case PIPE_SHADER_GEOMETRY:
|
||||
hash += key->gs.all;
|
||||
hash += static_cast<uint32_t>(key->gs.all);
|
||||
break;
|
||||
case PIPE_SHADER_FRAGMENT:
|
||||
hash += key->fs.all;
|
||||
@@ -823,7 +823,7 @@ d3d12_shader_key_hash(const d3d12_shader_key *key)
|
||||
hash = _mesa_hash_data_with_seed(&key->cs, sizeof(key->cs), hash);
|
||||
break;
|
||||
case PIPE_SHADER_TESS_CTRL:
|
||||
hash += key->hs.all;
|
||||
hash += static_cast<uint32_t>(key->hs.all);
|
||||
break;
|
||||
case PIPE_SHADER_TESS_EVAL:
|
||||
hash += key->ds.tcs_vertices_out;
|
||||
@@ -1142,9 +1142,9 @@ select_shader_variant(struct d3d12_selection_context *sel_ctx, d3d12_shader_sele
|
||||
}
|
||||
|
||||
if (key.stage == PIPE_SHADER_COMPUTE && sel->workgroup_size_variable) {
|
||||
new_nir_variant->info.workgroup_size[0] = key.cs.workgroup_size[0];
|
||||
new_nir_variant->info.workgroup_size[1] = key.cs.workgroup_size[1];
|
||||
new_nir_variant->info.workgroup_size[2] = key.cs.workgroup_size[2];
|
||||
new_nir_variant->info.workgroup_size[0] = static_cast<uint16_t>(key.cs.workgroup_size[0]);
|
||||
new_nir_variant->info.workgroup_size[1] = static_cast<uint16_t>(key.cs.workgroup_size[1]);
|
||||
new_nir_variant->info.workgroup_size[2] = static_cast<uint16_t>(key.cs.workgroup_size[2]);
|
||||
}
|
||||
|
||||
if (new_nir_variant->info.stage == MESA_SHADER_TESS_CTRL) {
|
||||
@@ -1155,7 +1155,7 @@ select_shader_variant(struct d3d12_selection_context *sel_ctx, d3d12_shader_sele
|
||||
|
||||
NIR_PASS_V(new_nir_variant, dxil_nir_set_tcs_patches_in, key.hs.patch_vertices_in);
|
||||
} else if (new_nir_variant->info.stage == MESA_SHADER_TESS_EVAL) {
|
||||
new_nir_variant->info.tess.tcs_vertices_out = key.ds.tcs_vertices_out;
|
||||
new_nir_variant->info.tess.tcs_vertices_out = static_cast<uint8_t>(key.ds.tcs_vertices_out);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1296,7 +1296,7 @@ update_so_info(struct pipe_stream_output_info *so_info,
|
||||
unsigned slot = 0;
|
||||
|
||||
while (outputs_written)
|
||||
reverse_map[slot++] = u_bit_scan64(&outputs_written);
|
||||
reverse_map[slot++] = static_cast<uint8_t>(u_bit_scan64(&outputs_written));
|
||||
|
||||
for (unsigned i = 0; i < so_info->num_outputs; i++) {
|
||||
struct pipe_stream_output *output = &so_info->output[i];
|
||||
|
||||
@@ -95,7 +95,7 @@ d3d12_create_vertex_elements_state(struct pipe_context *pctx,
|
||||
cso->elements[i].InstanceDataStepRate = 0;
|
||||
}
|
||||
max_vb = MAX2(max_vb, elements[i].vertex_buffer_index);
|
||||
cso->strides[elements[i].vertex_buffer_index] = elements[i].src_stride;
|
||||
cso->strides[elements[i].vertex_buffer_index] = static_cast<uint16_t>(elements[i].src_stride);
|
||||
}
|
||||
|
||||
cso->num_elements = num_elements;
|
||||
@@ -719,9 +719,9 @@ d3d12_bind_sampler_states(struct pipe_context *pctx,
|
||||
ctx->samplers[shader][start_slot + i] = sampler;
|
||||
dxil_wrap_sampler_state &wrap = ctx->tex_wrap_states[shader][start_slot + i];
|
||||
if (sampler) {
|
||||
wrap.wrap[0] = pipe_to_dxil_tex_wrap(sampler->wrap_s);
|
||||
wrap.wrap[1] = pipe_to_dxil_tex_wrap(sampler->wrap_t);
|
||||
wrap.wrap[2] = pipe_to_dxil_tex_wrap(sampler->wrap_r);
|
||||
wrap.wrap[0] = static_cast<uint8_t>(pipe_to_dxil_tex_wrap(sampler->wrap_s));
|
||||
wrap.wrap[1] = static_cast<uint8_t>(pipe_to_dxil_tex_wrap(sampler->wrap_t));
|
||||
wrap.wrap[2] = static_cast<uint8_t>(pipe_to_dxil_tex_wrap(sampler->wrap_r));
|
||||
wrap.lod_bias = sampler->lod_bias;
|
||||
wrap.min_lod = sampler->min_lod;
|
||||
wrap.max_lod = sampler->max_lod;
|
||||
@@ -1869,14 +1869,14 @@ d3d12_disable_fake_so_buffers(struct d3d12_context *ctx)
|
||||
if (key.fake_so_buffer_copy_back.num_ranges > 0) {
|
||||
auto& last_range = key.fake_so_buffer_copy_back.ranges[key.fake_so_buffer_copy_back.num_ranges - 1];
|
||||
if (output.dst_offset * 4 == last_range.offset + last_range.size) {
|
||||
last_range.size += output.num_components * 4;
|
||||
last_range.size += static_cast<uint16_t>(output.num_components * 4);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
auto& new_range = key.fake_so_buffer_copy_back.ranges[key.fake_so_buffer_copy_back.num_ranges++];
|
||||
new_range.offset = output.dst_offset * 4;
|
||||
new_range.size = output.num_components * 4;
|
||||
new_range.offset = static_cast<uint16_t>(output.dst_offset * 4);
|
||||
new_range.size = static_cast<uint16_t>(output.num_components * 4);
|
||||
}
|
||||
ctx->base.bind_compute_state(&ctx->base, d3d12_get_compute_transform(ctx, &key));
|
||||
|
||||
@@ -1945,12 +1945,12 @@ d3d12_clear_render_target(struct pipe_context *pctx,
|
||||
|
||||
if (util_format_is_pure_uint(format)) {
|
||||
for (int c = 0; c < 4 && !clear_fallback; ++c) {
|
||||
clear_color[c] = color->ui[c];
|
||||
clear_color[c] = static_cast<float>(color->ui[c]);
|
||||
clear_fallback = (uint32_t)clear_color[c] != color->ui[c];
|
||||
}
|
||||
} else if (util_format_is_pure_sint(format)) {
|
||||
for (int c = 0; c < 4 && !clear_fallback; ++c) {
|
||||
clear_color[c] = color->i[c];
|
||||
clear_color[c] = static_cast<float>(color->i[c]);
|
||||
clear_fallback = (int32_t)clear_color[c] != color->i[c];
|
||||
}
|
||||
} else {
|
||||
@@ -2043,7 +2043,7 @@ d3d12_clear_depth_stencil(struct pipe_context *pctx,
|
||||
(int)dstx + (int)width,
|
||||
(int)dsty + (int)height };
|
||||
ctx->cmdlist->ClearDepthStencilView(surf->desc_handle.cpu_handle, flags,
|
||||
depth, stencil, 1, &rect);
|
||||
static_cast<float>(depth), static_cast<UINT8>(stencil), 1, &rect);
|
||||
|
||||
d3d12_batch_reference_surface_texture(d3d12_current_batch(ctx), surf);
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ create_staging_resource(struct d3d12_context *ctx,
|
||||
|
||||
templ.format = src->base.b.format;
|
||||
templ.width0 = copy_src.width;
|
||||
templ.height0 = copy_src.height;
|
||||
templ.height0 = static_cast<uint16_t>(copy_src.height);
|
||||
templ.depth0 = copy_src.depth;
|
||||
templ.array_size = 1;
|
||||
templ.nr_samples = src->base.b.nr_samples;
|
||||
@@ -346,7 +346,7 @@ d3d12_resource_copy_region(struct pipe_context *pctx,
|
||||
|
||||
dst_box.x = dstx;
|
||||
dst_box.y = dsty;
|
||||
dst_box.z = dstz;
|
||||
dst_box.z = static_cast<int16_t>(dstz);
|
||||
dst_box.width = psrc_box->width;
|
||||
dst_box.height = psrc_box->height;
|
||||
|
||||
|
||||
@@ -377,8 +377,8 @@ fill_graphics_state_vars(struct d3d12_context *ctx,
|
||||
size += 4;
|
||||
break;
|
||||
case D3D12_STATE_VAR_PT_SPRITE:
|
||||
ptr[0] = fui(1.0 / ctx->viewports[0].Width);
|
||||
ptr[1] = fui(1.0 / ctx->viewports[0].Height);
|
||||
ptr[0] = fui(1.0f / ctx->viewports[0].Width);
|
||||
ptr[1] = fui(1.0f / ctx->viewports[0].Height);
|
||||
ptr[2] = fui(ctx->gfx_pipeline_state.rast->base.point_size);
|
||||
ptr[3] = fui(D3D12_MAX_POINT_SIZE);
|
||||
size += 4;
|
||||
@@ -391,8 +391,8 @@ fill_graphics_state_vars(struct d3d12_context *ctx,
|
||||
assert(!cmd_sig_key->draw_or_dispatch_params); // Should only be set once
|
||||
cmd_sig_key->draw_or_dispatch_params = 1;
|
||||
cmd_sig_key->root_sig = ctx->gfx_pipeline_state.root_signature;
|
||||
cmd_sig_key->params_root_const_offset = size;
|
||||
cmd_sig_key->params_root_const_param = cur_root_param_idx;
|
||||
cmd_sig_key->params_root_const_offset = static_cast<uint8_t>(size);
|
||||
cmd_sig_key->params_root_const_param = static_cast<uint8_t>(cur_root_param_idx);
|
||||
size += 4;
|
||||
break;
|
||||
case D3D12_STATE_VAR_DEPTH_TRANSFORM:
|
||||
@@ -439,7 +439,7 @@ fill_compute_state_vars(struct d3d12_context *ctx,
|
||||
ptr[2] = info->grid[2];
|
||||
cmd_sig_key->draw_or_dispatch_params = 1;
|
||||
cmd_sig_key->root_sig = ctx->compute_pipeline_state.root_signature;
|
||||
cmd_sig_key->params_root_const_offset = size;
|
||||
cmd_sig_key->params_root_const_offset = static_cast<uint8_t>(size);
|
||||
size += 4;
|
||||
break;
|
||||
case D3D12_STATE_VAR_TRANSFORM_GENERIC0:
|
||||
@@ -600,7 +600,7 @@ update_compute_root_parameters(struct d3d12_context *ctx,
|
||||
uint32_t constants[D3D12_MAX_COMPUTE_STATE_VARS * 4];
|
||||
unsigned size = fill_compute_state_vars(ctx, info, shader_sel->current, constants, cmd_sig_key);
|
||||
if (cmd_sig_key->draw_or_dispatch_params)
|
||||
cmd_sig_key->params_root_const_param = num_params;
|
||||
cmd_sig_key->params_root_const_param = static_cast<uint8_t>(num_params);
|
||||
ctx->cmdlist->SetComputeRoot32BitConstants(num_params, size, constants, 0);
|
||||
num_params++;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ d3d12_fence_create_event(int *fd)
|
||||
inline bool
|
||||
d3d12_fence_wait_event(HANDLE event, int event_fd, uint64_t timeout_ns)
|
||||
{
|
||||
DWORD timeout_ms = (timeout_ns == OS_TIMEOUT_INFINITE || timeout_ns > MaxTimeoutInNs) ? INFINITE : timeout_ns / NsPerMs;
|
||||
DWORD timeout_ms = (timeout_ns == OS_TIMEOUT_INFINITE || timeout_ns > MaxTimeoutInNs) ? INFINITE : (DWORD)(timeout_ns / NsPerMs);
|
||||
return WaitForSingleObject(event, timeout_ms) == WAIT_OBJECT_0;
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -197,7 +197,7 @@ d3d12_begin_emit_primitives_gs(struct emit_primitives_context *emit_ctx,
|
||||
nir->info.gs.input_primitive = MESA_PRIM_TRIANGLES;
|
||||
nir->info.gs.output_primitive = output_primitive;
|
||||
nir->info.gs.vertices_in = 3;
|
||||
nir->info.gs.vertices_out = vertices_out;
|
||||
nir->info.gs.vertices_out = static_cast<uint16_t>(vertices_out);
|
||||
nir->info.gs.invocations = 1;
|
||||
nir->info.gs.active_stream_mask = 1;
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ lower_emit_vertex(nir_intrinsic_instr *instr, nir_builder *b, struct lower_state
|
||||
for (unsigned j = 0; j < state->num_point_coords; ++j) {
|
||||
unsigned num_channels = glsl_get_components(state->point_coord_out[j]->type);
|
||||
unsigned mask = (1 << num_channels) - 1;
|
||||
nir_store_var(b, state->point_coord_out[j], nir_channels(b, point_coord, mask), mask);
|
||||
nir_store_var(b, state->point_coord_out[j], nir_channels(b, point_coord, (nir_component_mask_t)mask), (nir_component_mask_t)mask);
|
||||
}
|
||||
|
||||
/* EmitVertex */
|
||||
@@ -302,8 +302,8 @@ d3d12_lower_point_sprite(nir_shader *shader,
|
||||
|
||||
util_dynarray_fini(&state.output_writes);
|
||||
shader->info.gs.output_primitive = MESA_PRIM_TRIANGLE_STRIP;
|
||||
shader->info.gs.vertices_out = shader->info.gs.vertices_out * 4 /
|
||||
util_bitcount(shader->info.gs.active_stream_mask);
|
||||
shader->info.gs.vertices_out = (uint16_t) (shader->info.gs.vertices_out * 4 /
|
||||
util_bitcount(shader->info.gs.active_stream_mask));
|
||||
shader->info.gs.active_stream_mask = 1;
|
||||
|
||||
return progress;
|
||||
|
||||
@@ -547,7 +547,7 @@ d3d12_lower_state_vars(nir_shader *nir, struct d3d12_shader *shader)
|
||||
nir_variable *ubo = nir_variable_create(nir, nir_var_mem_ubo, type,
|
||||
"d3d12_state_vars");
|
||||
if (binding >= nir->info.num_ubos)
|
||||
nir->info.num_ubos = binding + 1;
|
||||
nir->info.num_ubos = (uint8_t) binding + 1;
|
||||
ubo->data.binding = binding;
|
||||
ubo->num_state_slots = 1;
|
||||
ubo->state_slots = ralloc_array(ubo, nir_state_slot, 1);
|
||||
@@ -878,7 +878,7 @@ split_varying_accesses(nir_builder *b, nir_intrinsic_instr *intr,
|
||||
if (intr->intrinsic == nir_intrinsic_store_deref) {
|
||||
unsigned mask_num_channels = (1 << var_state->subvars[subvar].num_components) - 1;
|
||||
unsigned orig_write_mask = nir_intrinsic_write_mask(intr);
|
||||
nir_def *sub_value = nir_channels(b, intr->src[1].ssa, mask_num_channels << first_channel);
|
||||
nir_def *sub_value = nir_channels(b, intr->src[1].ssa, (nir_component_mask_t) (mask_num_channels << first_channel));
|
||||
|
||||
unsigned new_write_mask = (orig_write_mask >> first_channel) & mask_num_channels;
|
||||
nir_build_store_deref(b, &new_path->def, sub_value, new_write_mask, nir_intrinsic_access(intr));
|
||||
@@ -918,7 +918,7 @@ d3d12_split_needed_varyings(nir_shader *s)
|
||||
for (unsigned i = 0; i < glsl_get_vector_elements(var->type); ++i) {
|
||||
unsigned stream = (var->data.stream >> (2 * (i + var->data.location_frac))) & 0x3;
|
||||
if (var_state->num_subvars == 0 || stream != subvars[var_state->num_subvars - 1].stream) {
|
||||
subvars[var_state->num_subvars].stream = stream;
|
||||
subvars[var_state->num_subvars].stream = (uint8_t)stream;
|
||||
subvars[var_state->num_subvars].num_components = 1;
|
||||
var_state->num_subvars++;
|
||||
} else {
|
||||
@@ -955,13 +955,13 @@ d3d12_split_needed_varyings(nir_shader *s)
|
||||
var_state->num_subvars = 2;
|
||||
subvars[0].var = var;
|
||||
subvars[0].num_components = 2;
|
||||
subvars[0].stream = var->data.stream;
|
||||
subvars[0].stream = (uint8_t)var->data.stream;
|
||||
const struct glsl_type *base_type = glsl_without_array(var->type);
|
||||
var->type = glsl_type_wrap_in_arrays(glsl_vector_type(glsl_get_base_type(base_type), 2), var->type);
|
||||
|
||||
subvars[1].var = nir_variable_clone(var, s);
|
||||
subvars[1].num_components = components - 2;
|
||||
subvars[1].stream = var->data.stream;
|
||||
subvars[1].num_components = (uint8_t) (components - 2);
|
||||
subvars[1].stream = (uint8_t)var->data.stream;
|
||||
exec_node_insert_after(&var->node, &subvars[1].var->node);
|
||||
subvars[1].var->type = glsl_type_wrap_in_arrays(glsl_vector_type(glsl_get_base_type(base_type), components - 2), var->type);
|
||||
subvars[1].var->data.location++;
|
||||
|
||||
@@ -138,8 +138,8 @@ fill_so_declaration(const struct pipe_stream_output_info *info,
|
||||
entries[*num_entries].SemanticName = NULL;
|
||||
entries[*num_entries].SemanticIndex = 0;
|
||||
entries[*num_entries].StartComponent = 0;
|
||||
entries[*num_entries].ComponentCount = skip_components;
|
||||
entries[*num_entries].OutputSlot = buffer;
|
||||
entries[*num_entries].ComponentCount = static_cast<BYTE>(skip_components);
|
||||
entries[*num_entries].OutputSlot = static_cast<BYTE>(buffer);
|
||||
(*num_entries)++;
|
||||
}
|
||||
|
||||
@@ -157,9 +157,9 @@ fill_so_declaration(const struct pipe_stream_output_info *info,
|
||||
}
|
||||
entries[*num_entries].SemanticName = get_semantic_name(location, var->data.driver_location, &index);
|
||||
entries[*num_entries].SemanticIndex = index;
|
||||
entries[*num_entries].StartComponent = output->start_component - var->data.location_frac;
|
||||
entries[*num_entries].ComponentCount = output->num_components;
|
||||
entries[*num_entries].OutputSlot = buffer;
|
||||
entries[*num_entries].StartComponent = static_cast<BYTE>(output->start_component - var->data.location_frac);
|
||||
entries[*num_entries].ComponentCount = static_cast<BYTE>(output->num_components);
|
||||
entries[*num_entries].OutputSlot = static_cast<BYTE>(buffer);
|
||||
(*num_entries)++;
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ create_gfx_pipeline_state(struct d3d12_context *ctx)
|
||||
rast.CullMode = D3D12_CULL_MODE_NONE;
|
||||
|
||||
if (depth_bias(state->rast, reduced_prim)) {
|
||||
rast.DepthBias = state->rast->base.offset_units * 2;
|
||||
rast.DepthBias = static_cast<INT>(state->rast->base.offset_units * 2);
|
||||
rast.DepthBiasClamp = state->rast->base.offset_clamp;
|
||||
rast.SlopeScaledDepthBias = state->rast->base.offset_scale;
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ convert_planar_resource(struct d3d12_resource *res)
|
||||
plane_res->plane_slice = plane;
|
||||
plane_res->base.b.format = util_format_get_plane_format(res->base.b.format, plane);
|
||||
plane_res->base.b.width0 = util_format_get_plane_width(res->base.b.format, plane, res->base.b.width0);
|
||||
plane_res->base.b.height0 = util_format_get_plane_height(res->base.b.format, plane, res->base.b.height0);
|
||||
plane_res->base.b.height0 = static_cast<uint16_t>(util_format_get_plane_height(res->base.b.format, plane, res->base.b.height0));
|
||||
|
||||
#if MESA_DEBUG
|
||||
struct d3d12_screen *screen = d3d12_screen(res->base.b.screen);
|
||||
@@ -637,7 +637,7 @@ d3d12_resource_from_handle(struct pipe_screen *pscreen,
|
||||
screen->dev->GetCopyableFootprints(&temp_desc, subresource, 1, 0, &placed_footprint, nullptr, nullptr, nullptr);
|
||||
} else {
|
||||
footprint->Format = incoming_res_desc.Format;
|
||||
footprint->Width = incoming_res_desc.Width;
|
||||
footprint->Width = static_cast<UINT>(incoming_res_desc.Width);
|
||||
footprint->Height = incoming_res_desc.Height;
|
||||
footprint->Depth = incoming_res_desc.DepthOrArraySize;
|
||||
}
|
||||
@@ -647,8 +647,8 @@ d3d12_resource_from_handle(struct pipe_screen *pscreen,
|
||||
debug_printf("d3d12: Importing resource too large\n");
|
||||
goto invalid;
|
||||
}
|
||||
res->base.b.width0 = incoming_res_desc.Width;
|
||||
res->base.b.height0 = incoming_res_desc.Height;
|
||||
res->base.b.width0 = static_cast<uint32_t>(incoming_res_desc.Width);
|
||||
res->base.b.height0 = static_cast<uint16_t>(incoming_res_desc.Height);
|
||||
res->base.b.depth0 = 1;
|
||||
res->base.b.array_size = 1;
|
||||
|
||||
@@ -671,14 +671,14 @@ d3d12_resource_from_handle(struct pipe_screen *pscreen,
|
||||
break;
|
||||
case D3D12_RESOURCE_DIMENSION_TEXTURE3D:
|
||||
res->base.b.target = PIPE_TEXTURE_3D;
|
||||
res->base.b.depth0 = footprint->Depth;
|
||||
res->base.b.depth0 = static_cast<uint16_t>(footprint->Depth);
|
||||
break;
|
||||
default:
|
||||
unreachable("Invalid dimension");
|
||||
break;
|
||||
}
|
||||
res->base.b.nr_samples = incoming_res_desc.SampleDesc.Count;
|
||||
res->base.b.last_level = incoming_res_desc.MipLevels - 1;
|
||||
res->base.b.nr_samples = static_cast<uint8_t>(incoming_res_desc.SampleDesc.Count);
|
||||
res->base.b.last_level = static_cast<uint8_t>(incoming_res_desc.MipLevels - 1);
|
||||
res->base.b.usage = PIPE_USAGE_DEFAULT;
|
||||
res->base.b.bind |= PIPE_BIND_SHARED;
|
||||
if (incoming_res_desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET)
|
||||
@@ -860,8 +860,8 @@ d3d12_resource_from_resource(struct pipe_screen *pscreen,
|
||||
}
|
||||
|
||||
templ.format = d3d12_get_pipe_format(input_desc.Format);
|
||||
templ.width0 = input_desc.Width;
|
||||
templ.height0 = input_desc.Height;
|
||||
templ.width0 = static_cast<uint32_t>(input_desc.Width);
|
||||
templ.height0 = static_cast<uint16_t>(input_desc.Height);
|
||||
templ.depth0 = input_desc.DepthOrArraySize;
|
||||
templ.array_size = input_desc.DepthOrArraySize;
|
||||
templ.flags = 0;
|
||||
@@ -904,10 +904,10 @@ static void d3d12_adjust_transfer_dimensions_for_plane(const struct d3d12_resour
|
||||
float height_multiplier = res->first_plane->height0 / (float) util_format_get_plane_height(res->overall_format, res->plane_slice, res->first_plane->height0);
|
||||
|
||||
/* Normalize box back to overall dimensions (first plane)*/
|
||||
ptrans->box.width = width_multiplier * original_box->width;
|
||||
ptrans->box.height = height_multiplier * original_box->height;
|
||||
ptrans->box.x = width_multiplier * original_box->x;
|
||||
ptrans->box.y = height_multiplier * original_box->y;
|
||||
ptrans->box.width = static_cast<int32_t>(width_multiplier * original_box->width);
|
||||
ptrans->box.height = static_cast<int32_t>(height_multiplier * original_box->height);
|
||||
ptrans->box.x = static_cast<int32_t>(width_multiplier * original_box->x);
|
||||
ptrans->box.y = static_cast<int32_t>(height_multiplier * original_box->y);
|
||||
|
||||
/* Now adjust dimensions to plane_slice*/
|
||||
ptrans->box.width = util_format_get_plane_width(res->overall_format, plane_slice, ptrans->box.width);
|
||||
@@ -936,10 +936,10 @@ void d3d12_resource_get_planes_info(pipe_resource *pres,
|
||||
strides[plane_slice] = align(util_format_get_stride(cur_plane_resource->format, width),
|
||||
D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
|
||||
|
||||
layer_strides[plane_slice] = align(util_format_get_2d_size(cur_plane_resource->format,
|
||||
strides[plane_slice],
|
||||
height),
|
||||
D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);
|
||||
layer_strides[plane_slice] = static_cast<unsigned>(align(static_cast<uint32_t>(util_format_get_2d_size(cur_plane_resource->format,
|
||||
strides[plane_slice],
|
||||
height)),
|
||||
D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT));
|
||||
|
||||
offsets[plane_slice] = *staging_res_size;
|
||||
*staging_res_size += layer_strides[plane_slice];
|
||||
@@ -1082,7 +1082,7 @@ d3d12_resource_from_memobj(struct pipe_screen *pscreen,
|
||||
struct winsys_handle whandle = {};
|
||||
whandle.type = WINSYS_HANDLE_TYPE_D3D12_RES;
|
||||
whandle.com_obj = memobj->res ? (void *) memobj->res : (void *) memobj->heap;
|
||||
whandle.offset = offset;
|
||||
whandle.offset = static_cast<unsigned int>(offset);
|
||||
whandle.format = templ->format;
|
||||
whandle.modifier = memobj->res ? 0 : 1;
|
||||
|
||||
@@ -1392,8 +1392,8 @@ transfer_buf_to_buf(struct d3d12_context *ctx,
|
||||
width);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
linear_offset(int x, int y, int z, unsigned stride, unsigned layer_stride)
|
||||
static size_t
|
||||
linear_offset(int x, int y, int z, unsigned stride, size_t layer_stride)
|
||||
{
|
||||
return x +
|
||||
y * stride +
|
||||
@@ -1401,7 +1401,7 @@ linear_offset(int x, int y, int z, unsigned stride, unsigned layer_stride)
|
||||
}
|
||||
|
||||
static D3D12_RANGE
|
||||
linear_range(const struct pipe_box *box, unsigned stride, unsigned layer_stride)
|
||||
linear_range(const struct pipe_box *box, unsigned stride, size_t layer_stride)
|
||||
{
|
||||
D3D12_RANGE range;
|
||||
|
||||
@@ -1426,7 +1426,7 @@ synchronize(struct d3d12_context *ctx,
|
||||
/* Check whether that range contains valid data; if not, we might not need to sync */
|
||||
if (!(usage & PIPE_MAP_UNSYNCHRONIZED) &&
|
||||
usage & PIPE_MAP_WRITE &&
|
||||
!util_ranges_intersect(&res->valid_buffer_range, range->Begin, range->End)) {
|
||||
!util_ranges_intersect(&res->valid_buffer_range, static_cast<unsigned int>(range->Begin), static_cast<unsigned int>(range->End))) {
|
||||
usage |= PIPE_MAP_UNSYNCHRONIZED;
|
||||
}
|
||||
|
||||
@@ -1442,7 +1442,7 @@ synchronize(struct d3d12_context *ctx,
|
||||
|
||||
if (usage & PIPE_MAP_WRITE)
|
||||
util_range_add(&res->base.b, &res->valid_buffer_range,
|
||||
range->Begin, range->End);
|
||||
static_cast<unsigned int>(range->Begin), static_cast<unsigned int>(range->End));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1516,12 +1516,12 @@ prepare_zs_layer_strides(struct d3d12_screen *screen,
|
||||
if (copy_whole_resource) {
|
||||
trans->zs_cpu_copy_stride = align(util_format_get_stride(res->base.b.format, box->width),
|
||||
D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
|
||||
trans->zs_cpu_copy_layer_stride = util_format_get_2d_size(res->base.b.format,
|
||||
trans->base.b.stride,
|
||||
box->height);
|
||||
trans->zs_cpu_copy_layer_stride = static_cast<unsigned int>(util_format_get_2d_size(res->base.b.format,
|
||||
trans->base.b.stride,
|
||||
box->height));
|
||||
} else {
|
||||
trans->zs_cpu_copy_stride = trans->base.b.stride;
|
||||
trans->zs_cpu_copy_layer_stride = trans->base.b.layer_stride;
|
||||
trans->zs_cpu_copy_layer_stride = static_cast<unsigned int>(trans->base.b.layer_stride);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1542,7 +1542,7 @@ read_zs_surface(struct d3d12_context *ctx, struct d3d12_resource *res,
|
||||
tmpl.bind = 0;
|
||||
tmpl.usage = PIPE_USAGE_STAGING;
|
||||
tmpl.flags = 0;
|
||||
tmpl.width0 = trans->base.b.layer_stride;
|
||||
tmpl.width0 = static_cast<uint32_t>(trans->base.b.layer_stride);
|
||||
tmpl.height0 = 1;
|
||||
tmpl.depth0 = 1;
|
||||
tmpl.array_size = 1;
|
||||
@@ -1644,7 +1644,7 @@ write_zs_surface(struct pipe_context *pctx, struct d3d12_resource *res,
|
||||
tmpl.bind = 0;
|
||||
tmpl.usage = PIPE_USAGE_STAGING;
|
||||
tmpl.flags = 0;
|
||||
tmpl.width0 = trans->base.b.layer_stride;
|
||||
tmpl.width0 = static_cast<uint32_t>(trans->base.b.layer_stride);
|
||||
tmpl.height0 = 1;
|
||||
tmpl.depth0 = 1;
|
||||
tmpl.array_size = 1;
|
||||
@@ -1841,13 +1841,13 @@ d3d12_transfer_map(struct pipe_context *pctx,
|
||||
box->height);
|
||||
|
||||
if (res->base.b.target != PIPE_TEXTURE_3D)
|
||||
ptrans->layer_stride = align(ptrans->layer_stride,
|
||||
D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);
|
||||
ptrans->layer_stride = static_cast<uintptr_t>(align(static_cast<uint32_t>(ptrans->layer_stride),
|
||||
D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT));
|
||||
|
||||
if (util_format_has_depth(util_format_description(pres->format)) &&
|
||||
screen->opts2.ProgrammableSamplePositionsTier == D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED) {
|
||||
trans->zs_cpu_copy_stride = ptrans->stride;
|
||||
trans->zs_cpu_copy_layer_stride = ptrans->layer_stride;
|
||||
trans->zs_cpu_copy_layer_stride = static_cast<unsigned int>(ptrans->layer_stride);
|
||||
|
||||
ptrans->stride = align(util_format_get_stride(pres->format, pres->width0),
|
||||
D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
|
||||
@@ -1859,7 +1859,7 @@ d3d12_transfer_map(struct pipe_context *pctx,
|
||||
box->x * util_format_get_blocksize(pres->format);
|
||||
}
|
||||
|
||||
unsigned staging_res_size = ptrans->layer_stride * box->depth;
|
||||
unsigned staging_res_size = static_cast<unsigned>(ptrans->layer_stride * box->depth);
|
||||
if (res->base.b.target == PIPE_BUFFER) {
|
||||
/* To properly support ARB_map_buffer_alignment, we need to return a pointer
|
||||
* that's appropriately offset from a 64-byte-aligned base address.
|
||||
|
||||
@@ -120,7 +120,7 @@ d3d12_get_video_mem(struct pipe_screen *pscreen)
|
||||
{
|
||||
struct d3d12_screen* screen = d3d12_screen(pscreen);
|
||||
|
||||
return screen->memory_device_size_megabytes + screen->memory_system_size_megabytes;
|
||||
return static_cast<int>(screen->memory_device_size_megabytes + screen->memory_system_size_megabytes);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1368,28 +1368,28 @@ d3d12_query_memory_info(struct pipe_screen *pscreen, struct pipe_memory_info *in
|
||||
DXGI_MEMORY_SEGMENT_GROUP_LOCAL, as there is only one unified memory and it's all "local" to the GPU.
|
||||
*/
|
||||
info->total_device_memory =
|
||||
(screen->memory_device_size_megabytes << 10) + (screen->memory_system_size_megabytes << 10);
|
||||
static_cast<unsigned int>(CLAMP((screen->memory_device_size_megabytes << 10) + (screen->memory_system_size_megabytes << 10), 0u, UINT32_MAX));
|
||||
info->total_staging_memory = 0;
|
||||
} else {
|
||||
info->total_device_memory = (screen->memory_device_size_megabytes << 10);
|
||||
info->total_staging_memory = (screen->memory_system_size_megabytes << 10);
|
||||
info->total_device_memory = static_cast<unsigned int>(CLAMP(screen->memory_device_size_megabytes << 10, 0u, UINT32_MAX));
|
||||
info->total_staging_memory = static_cast<unsigned int>(CLAMP(screen->memory_system_size_megabytes << 10, 0u, UINT32_MAX));;
|
||||
}
|
||||
|
||||
d3d12_memory_info m;
|
||||
screen->get_memory_info(screen, &m);
|
||||
// bytes to kilobytes
|
||||
if (m.budget_local > m.usage_local) {
|
||||
info->avail_device_memory = (m.budget_local - m.usage_local) / 1024;
|
||||
info->avail_device_memory = static_cast<unsigned int>(CLAMP((m.budget_local - m.usage_local) / 1024, 0u, UINT32_MAX));
|
||||
} else {
|
||||
info->avail_device_memory = 0;
|
||||
}
|
||||
if (m.budget_nonlocal > m.usage_nonlocal) {
|
||||
info->avail_staging_memory = (m.budget_nonlocal - m.usage_nonlocal) / 1024;
|
||||
info->avail_staging_memory = static_cast<unsigned int>(CLAMP(m.budget_nonlocal - m.usage_nonlocal / 1024, 0u, UINT32_MAX));
|
||||
} else {
|
||||
info->avail_staging_memory = 0;
|
||||
}
|
||||
|
||||
info->device_memory_evicted = screen->total_bytes_evicted / 1024;
|
||||
info->device_memory_evicted = static_cast<unsigned int>(CLAMP(screen->total_bytes_evicted / 1024, 0u, UINT32_MAX));
|
||||
info->nr_device_memory_evictions = screen->num_evictions;
|
||||
}
|
||||
|
||||
@@ -1397,7 +1397,7 @@ bool
|
||||
d3d12_init_screen_base(struct d3d12_screen *screen, struct sw_winsys *winsys, LUID *adapter_luid)
|
||||
{
|
||||
glsl_type_singleton_init_or_ref();
|
||||
d3d12_debug = debug_get_option_d3d12_debug();
|
||||
d3d12_debug = static_cast<uint32_t>(debug_get_option_d3d12_debug());
|
||||
|
||||
screen->winsys = winsys;
|
||||
if (adapter_luid)
|
||||
|
||||
@@ -248,8 +248,8 @@ d3d12_create_surface(struct pipe_context *pctx,
|
||||
pipe_reference_init(&surface->base.reference, 1);
|
||||
surface->base.context = pctx;
|
||||
surface->base.format = tpl->format;
|
||||
surface->base.width = u_minify(pres->width0, tpl->u.tex.level);
|
||||
surface->base.height = u_minify(pres->height0, tpl->u.tex.level);
|
||||
surface->base.width = static_cast<uint16_t>(u_minify(pres->width0, tpl->u.tex.level));
|
||||
surface->base.height = static_cast<uint16_t>(u_minify(pres->height0, tpl->u.tex.level));
|
||||
surface->base.u.tex.level = tpl->u.tex.level;
|
||||
surface->base.u.tex.first_layer = tpl->u.tex.first_layer;
|
||||
surface->base.u.tex.last_layer = tpl->u.tex.last_layer;
|
||||
|
||||
@@ -135,7 +135,7 @@ create_tess_ctrl_shader_variant(struct d3d12_context *ctx, struct d3d12_tcs_vari
|
||||
nir_store_deref(&b, store_idx, nir_channel(&b, load_outer, i), 0xff);
|
||||
}
|
||||
|
||||
nir->info.tess.tcs_vertices_out = key->vertices_out;
|
||||
nir->info.tess.tcs_vertices_out = static_cast<uint8_t>(key->vertices_out);
|
||||
nir_validate_shader(nir, "created");
|
||||
NIR_PASS_V(nir, nir_lower_var_copies);
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ d3d12_video_buffer_create_impl(struct pipe_context *pipe,
|
||||
// YUV 4:2:0 formats in D3D12 always require multiple of 2 dimensions
|
||||
// We must respect the input dimensions of the imported resource handle (e.g no extra aligning)
|
||||
resource_creation_info->width0 = align(pD3D12VideoBuffer->base.width, 2);
|
||||
resource_creation_info->height0 = align(pD3D12VideoBuffer->base.height, 2);
|
||||
resource_creation_info->height0 = static_cast<uint16_t>(align(pD3D12VideoBuffer->base.height, 2));
|
||||
|
||||
// WINSYS_HANDLE_TYPE_D3D12_RES implies taking ownership of the reference
|
||||
if(handle->type == WINSYS_HANDLE_TYPE_D3D12_RES)
|
||||
@@ -125,7 +125,7 @@ d3d12_video_buffer_create_impl(struct pipe_context *pipe,
|
||||
// When creating (e.g not importing) resources we allocate
|
||||
// with a higher alignment to maximize HW compatibility
|
||||
resource_creation_info->width0 = align(pD3D12VideoBuffer->base.width, 2);
|
||||
resource_creation_info->height0 = align(pD3D12VideoBuffer->base.height, 16);
|
||||
resource_creation_info->height0 = static_cast<uint16_t>(align(pD3D12VideoBuffer->base.height, 16));
|
||||
|
||||
pD3D12VideoBuffer->texture = (struct d3d12_resource *) pipe->screen->resource_create(pipe->screen, resource_creation_info);
|
||||
}
|
||||
@@ -176,7 +176,7 @@ d3d12_video_buffer_from_handle(struct pipe_context *pipe,
|
||||
}
|
||||
}
|
||||
D3D12_RESOURCE_DESC res_desc = GetDesc(d3d12_res);
|
||||
updated_template.width = res_desc.Width;
|
||||
updated_template.width = static_cast<unsigned int>(res_desc.Width);
|
||||
updated_template.height = res_desc.Height;
|
||||
updated_template.buffer_format = d3d12_get_pipe_format(res_desc.Format);
|
||||
handle->format = updated_template.buffer_format;
|
||||
@@ -527,7 +527,7 @@ d3d12_video_create_dpb_buffer_texarray(struct pipe_video_codec *codec,
|
||||
if (!pD3D12Enc->m_pVideoTexArrayDPBPool)
|
||||
{
|
||||
pipe_resource resource_creation_info = {};
|
||||
resource_creation_info.array_size = d3d12_video_encoder_get_current_max_dpb_capacity(pD3D12Enc);
|
||||
resource_creation_info.array_size = static_cast<uint16_t>(d3d12_video_encoder_get_current_max_dpb_capacity(pD3D12Enc));
|
||||
assert(resource_creation_info.array_size <= 32); // uint32_t used as a usage bitmap into m_pVideoTexArrayDPBPool
|
||||
buf = (d3d12_video_buffer*) d3d12_video_buffer_create_impl(codec->context, templat, &resource_creation_info, d3d12_video_buffer_creation_mode::create_resource, NULL, 0);
|
||||
pD3D12Enc->m_pVideoTexArrayDPBPool = &buf->texture->base.b;
|
||||
|
||||
@@ -469,7 +469,7 @@ d3d12_video_decoder_end_frame(struct pipe_video_codec *codec,
|
||||
inFlightResources.pPipeCompressedBufferObj, // dst buffer
|
||||
PIPE_MAP_WRITE, // usage PIPE_MAP_x
|
||||
0, // offset
|
||||
static_cast<UINT>(sizeof(*sliceDataStagingBufferPtr)) * sliceDataStagingBufferSize, // size
|
||||
static_cast<unsigned int>(sizeof(*sliceDataStagingBufferPtr) * sliceDataStagingBufferSize), // size
|
||||
sliceDataStagingBufferPtr // data
|
||||
);
|
||||
|
||||
@@ -1192,7 +1192,7 @@ d3d12_video_decoder_reconfigure_dpb(struct d3d12_video_decoder *pD3D12Dec,
|
||||
D3D12_VIDEO_DECODER_HEAP_DESC decoderHeapDesc = {};
|
||||
decoderHeapDesc.NodeMask = pD3D12Dec->m_NodeMask;
|
||||
decoderHeapDesc.Configuration = pD3D12Dec->m_decoderDesc.Configuration;
|
||||
decoderHeapDesc.DecodeWidth = dpbDesc.Width;
|
||||
decoderHeapDesc.DecodeWidth = static_cast<UINT>(dpbDesc.Width);
|
||||
decoderHeapDesc.DecodeHeight = dpbDesc.Height;
|
||||
decoderHeapDesc.Format = dpbDesc.Format;
|
||||
decoderHeapDesc.MaxDecodePictureBufferCount = maxDPB;
|
||||
@@ -1327,7 +1327,7 @@ d3d12_video_decoder_store_converted_dxva_picparams_from_pipe_input(
|
||||
DXVA_PicParams_H264 dxvaPicParamsH264 =
|
||||
d3d12_video_decoder_dxva_picparams_from_pipe_picparams_h264(pD3D12Dec->m_fenceValue,
|
||||
codec->base.profile,
|
||||
outputResourceDesc.Width,
|
||||
static_cast<UINT>(outputResourceDesc.Width),
|
||||
outputResourceDesc.Height,
|
||||
pPicControlH264);
|
||||
|
||||
|
||||
@@ -83,10 +83,10 @@ d3d12_video_decoder_prepare_current_frame_references_av1(struct d3d12_video_deco
|
||||
uint32_t subresourceIndex)
|
||||
{
|
||||
DXVA_PicParams_AV1 *pPicParams = d3d12_video_decoder_get_current_dxva_picparams<DXVA_PicParams_AV1>(pD3D12Dec);
|
||||
pPicParams->CurrPicTextureIndex = pD3D12Dec->m_spDPBManager->store_future_reference(pPicParams->CurrPicTextureIndex,
|
||||
pD3D12Dec->m_spVideoDecoderHeap,
|
||||
pTexture2D,
|
||||
subresourceIndex);
|
||||
pPicParams->CurrPicTextureIndex = static_cast<uint8_t>(pD3D12Dec->m_spDPBManager->store_future_reference(pPicParams->CurrPicTextureIndex,
|
||||
pD3D12Dec->m_spVideoDecoderHeap,
|
||||
pTexture2D,
|
||||
subresourceIndex));
|
||||
pD3D12Dec->m_spDPBManager->update_entries_av1(
|
||||
d3d12_video_decoder_get_current_dxva_picparams<DXVA_PicParams_AV1>(pD3D12Dec)->RefFrameMapTextureIndex,
|
||||
pD3D12Dec->m_transitionsStorage);
|
||||
@@ -411,8 +411,8 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_av1(
|
||||
for (uint32_t i = 0; i < dxvaStructure.tiles.cols - 1u; i++)
|
||||
acumSbWMinusLast += dxvaStructure.tiles.widths[i];
|
||||
|
||||
dxvaStructure.tiles.widths[dxvaStructure.tiles.cols-1] =
|
||||
std::ceil(pipe_av1->picture_parameter.frame_width / (float)sbPixSize) - acumSbWMinusLast;
|
||||
dxvaStructure.tiles.widths[dxvaStructure.tiles.cols-1] = static_cast<uint16_t>(
|
||||
std::ceil(pipe_av1->picture_parameter.frame_width / (float)sbPixSize) - acumSbWMinusLast);
|
||||
}
|
||||
|
||||
if (dxvaStructure.tiles.rows > 1) {
|
||||
@@ -420,8 +420,8 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_av1(
|
||||
for (uint32_t i = 0; i < dxvaStructure.tiles.rows - 1u; i++)
|
||||
acumSbHMinusLast += dxvaStructure.tiles.heights[i];
|
||||
|
||||
dxvaStructure.tiles.heights[dxvaStructure.tiles.rows-1] =
|
||||
std::ceil(pipe_av1->picture_parameter.frame_width / (float)sbPixSize) - acumSbHMinusLast;
|
||||
dxvaStructure.tiles.heights[dxvaStructure.tiles.rows-1] = static_cast<uint16_t>(
|
||||
std::ceil(pipe_av1->picture_parameter.frame_width / (float)sbPixSize) - acumSbHMinusLast);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -296,10 +296,10 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_h264(
|
||||
|
||||
// uint16_t wFrameWidthInMbsMinus1;
|
||||
uint width_in_mb = decodeWidth / D3D12_VIDEO_H264_MB_IN_PIXELS;
|
||||
dxvaStructure.wFrameWidthInMbsMinus1 = width_in_mb - 1;
|
||||
dxvaStructure.wFrameWidthInMbsMinus1 = static_cast<uint16_t>(width_in_mb - 1);
|
||||
// uint16_t wFrameHeightInMbsMinus1;
|
||||
uint height_in_mb = static_cast<uint>(std::ceil(decodeHeight / D3D12_VIDEO_H264_MB_IN_PIXELS));
|
||||
dxvaStructure.wFrameHeightInMbsMinus1 = height_in_mb - 1;
|
||||
dxvaStructure.wFrameHeightInMbsMinus1 = static_cast<uint16_t>(height_in_mb - 1);
|
||||
|
||||
// CurrPic.Index7Bits is handled by d3d12_video_decoder_refresh_dpb_active_references_h264
|
||||
// CurrPic.AssociatedFlag
|
||||
@@ -374,7 +374,7 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_h264(
|
||||
dxvaStructure.num_ref_idx_l1_active_minus1 = pPipeDesc->num_ref_idx_l1_active_minus1;
|
||||
|
||||
// uint16_t frame_num;
|
||||
dxvaStructure.frame_num = pPipeDesc->frame_num;
|
||||
dxvaStructure.frame_num = static_cast<uint16_t>(pPipeDesc->frame_num);
|
||||
|
||||
// uint8_t log2_max_frame_num_minus4;
|
||||
dxvaStructure.log2_max_frame_num_minus4 = pPipeDesc->pps->sps->log2_max_frame_num_minus4;
|
||||
@@ -466,7 +466,7 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_h264(
|
||||
// entry in RefFrameList is empty or is marked as "not used for reference"), the value
|
||||
// of the FrameNumList entry shall be 0. Accelerators can rely on this constraint being
|
||||
// fulfilled.
|
||||
dxvaStructure.FrameNumList[i] = pPipeDesc->frame_num_list[i];
|
||||
dxvaStructure.FrameNumList[i] = static_cast<uint16_t>(pPipeDesc->frame_num_list[i]);
|
||||
|
||||
// int32_t FieldOrderCntList[16][2];
|
||||
// Contains the picture order counts for the reference frames listed in RefFrameList.
|
||||
|
||||
@@ -386,8 +386,8 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_hevc(
|
||||
memset(&dxvaStructure, 0, sizeof(dxvaStructure));
|
||||
|
||||
uint8_t log2_min_cb_size = sps->log2_min_luma_coding_block_size_minus3 + 3;
|
||||
dxvaStructure.PicWidthInMinCbsY = sps->pic_width_in_luma_samples >> log2_min_cb_size;
|
||||
dxvaStructure.PicHeightInMinCbsY = sps->pic_height_in_luma_samples >> log2_min_cb_size;
|
||||
dxvaStructure.PicWidthInMinCbsY = static_cast<uint16_t>(sps->pic_width_in_luma_samples >> log2_min_cb_size);
|
||||
dxvaStructure.PicHeightInMinCbsY = static_cast<uint16_t>(sps->pic_height_in_luma_samples >> log2_min_cb_size);
|
||||
dxvaStructure.chroma_format_idc = sps->chroma_format_idc;
|
||||
dxvaStructure.separate_colour_plane_flag = sps->separate_colour_plane_flag;
|
||||
dxvaStructure.bit_depth_luma_minus8 = sps->bit_depth_luma_minus8;
|
||||
@@ -415,7 +415,7 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_hevc(
|
||||
|
||||
// NumDeltaPocsOfRefRpsIdx is not passed from VA to pipe, and VA doesn't have it defined in their va_dec_hevc header.
|
||||
// DXVA drivers should use wNumBitsForShortTermRPSInSlice (st_rps_bits in VA) to derive the slice header info instead
|
||||
dxvaStructure.ucNumDeltaPocsOfRefRpsIdx = pPipeDesc->NumDeltaPocsOfRefRpsIdx;
|
||||
dxvaStructure.ucNumDeltaPocsOfRefRpsIdx = static_cast<uint8_t>(pPipeDesc->NumDeltaPocsOfRefRpsIdx);
|
||||
dxvaStructure.wNumBitsForShortTermRPSInSlice = pps->st_rps_bits;
|
||||
|
||||
dxvaStructure.scaling_list_enabled_flag = sps->scaling_list_enabled_flag;
|
||||
|
||||
@@ -286,7 +286,7 @@ d3d12_video_decoder_references_manager::store_future_reference(uint16_t
|
||||
|
||||
// Store the index to use for error handling when caller specifies and invalid reference index.
|
||||
m_currentOutputIndex = remappedIndex;
|
||||
m_currentSubresourceIndex = subresourceIndex;
|
||||
m_currentSubresourceIndex = static_cast<uint16_t>(subresourceIndex);
|
||||
m_currentResource = pTexture2D;
|
||||
|
||||
return remappedIndex;
|
||||
|
||||
@@ -90,7 +90,7 @@ struct d3d12_video_decoder_references_manager
|
||||
|
||||
uint8_t get_unused_index7bits()
|
||||
{
|
||||
for (uint32_t testIdx = 0; testIdx < 127; testIdx++) {
|
||||
for (uint8_t testIdx = 0; testIdx < 127; testIdx++) {
|
||||
auto it = std::find_if(m_DecodeTargetToOriginalIndex7Bits.begin(), m_DecodeTargetToOriginalIndex7Bits.end(),
|
||||
[&testIdx](const std::pair< struct pipe_video_buffer*, uint8_t > &p) {
|
||||
return p.second == testIdx;
|
||||
@@ -237,8 +237,8 @@ d3d12_video_decoder_references_manager::update_entries_av1(T (&picEntries)[size]
|
||||
uint32_t OutputSubresource = 0u;
|
||||
bool outNeedsTransitionToDecodeRead = false;
|
||||
|
||||
picEntry =
|
||||
update_entry(picEntry, pOutputReference, OutputSubresource, outNeedsTransitionToDecodeRead);
|
||||
picEntry = static_cast<T>(
|
||||
update_entry(picEntry, pOutputReference, OutputSubresource, outNeedsTransitionToDecodeRead));
|
||||
|
||||
if (outNeedsTransitionToDecodeRead) {
|
||||
///
|
||||
|
||||
@@ -284,7 +284,7 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_vp9(
|
||||
memset(&dxvaStructure, 0, sizeof(dxvaStructure));
|
||||
|
||||
dxvaStructure.profile = pipe_vp9->picture_parameter.profile;
|
||||
dxvaStructure.wFormatAndPictureInfoFlags = ((pipe_vp9->picture_parameter.pic_fields.frame_type != 0) << 0) |
|
||||
dxvaStructure.wFormatAndPictureInfoFlags = static_cast<uint16_t>(((pipe_vp9->picture_parameter.pic_fields.frame_type != 0) << 0) |
|
||||
((pipe_vp9->picture_parameter.pic_fields.show_frame != 0) << 1) |
|
||||
(pipe_vp9->picture_parameter.pic_fields.error_resilient_mode << 2) |
|
||||
(pipe_vp9->picture_parameter.pic_fields.subsampling_x << 3) |
|
||||
@@ -296,7 +296,7 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_vp9(
|
||||
(pipe_vp9->picture_parameter.pic_fields.frame_context_idx << 9) |
|
||||
(pipe_vp9->picture_parameter.pic_fields.reset_frame_context << 11) |
|
||||
((pipe_vp9->picture_parameter.pic_fields.allow_high_precision_mv) << 13) |
|
||||
(0 << 14);
|
||||
(0 << 14));
|
||||
|
||||
dxvaStructure.width = pipe_vp9->picture_parameter.frame_width;
|
||||
dxvaStructure.height = pipe_vp9->picture_parameter.frame_height;
|
||||
@@ -371,11 +371,11 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_vp9(
|
||||
dxvaStructure.uv_ac_delta_q = pipe_vp9->picture_parameter.uv_dc_delta_q;
|
||||
|
||||
/* segmentation data */
|
||||
dxvaStructure.stVP9Segments.wSegmentInfoFlags = (pipe_vp9->picture_parameter.pic_fields.segmentation_enabled << 0) |
|
||||
(pipe_vp9->picture_parameter.pic_fields.segmentation_update_map << 1) |
|
||||
(pipe_vp9->picture_parameter.pic_fields.segmentation_temporal_update << 2) |
|
||||
(pipe_vp9->picture_parameter.abs_delta << 3) |
|
||||
(0 << 4);
|
||||
dxvaStructure.stVP9Segments.wSegmentInfoFlags = static_cast<uint8_t>((pipe_vp9->picture_parameter.pic_fields.segmentation_enabled << 0) |
|
||||
(pipe_vp9->picture_parameter.pic_fields.segmentation_update_map << 1) |
|
||||
(pipe_vp9->picture_parameter.pic_fields.segmentation_temporal_update << 2) |
|
||||
(pipe_vp9->picture_parameter.abs_delta << 3) |
|
||||
(0 << 4));
|
||||
|
||||
for (uint32_t i = 0; i < 7; i++)
|
||||
dxvaStructure.stVP9Segments.tree_probs[i] = pipe_vp9->picture_parameter.mb_segment_tree_probs[i];
|
||||
@@ -387,10 +387,10 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_vp9(
|
||||
memset(dxvaStructure.stVP9Segments.pred_probs, 255, sizeof(dxvaStructure.stVP9Segments.pred_probs));
|
||||
|
||||
for (uint32_t i = 0; i < 8; i++) {
|
||||
dxvaStructure.stVP9Segments.feature_mask[i] = (pipe_vp9->slice_parameter.seg_param[i].alt_quant_enabled << 0) |
|
||||
(pipe_vp9->slice_parameter.seg_param[i].alt_lf_enabled << 1) |
|
||||
(pipe_vp9->slice_parameter.seg_param[i].segment_flags.segment_reference_enabled << 2) |
|
||||
(pipe_vp9->slice_parameter.seg_param[i].segment_flags.segment_reference_skipped << 3);
|
||||
dxvaStructure.stVP9Segments.feature_mask[i] = static_cast<uint8_t>((pipe_vp9->slice_parameter.seg_param[i].alt_quant_enabled << 0) |
|
||||
(pipe_vp9->slice_parameter.seg_param[i].alt_lf_enabled << 1) |
|
||||
(pipe_vp9->slice_parameter.seg_param[i].segment_flags.segment_reference_enabled << 2) |
|
||||
(pipe_vp9->slice_parameter.seg_param[i].segment_flags.segment_reference_skipped << 3));
|
||||
|
||||
dxvaStructure.stVP9Segments.feature_data[i][0] = pipe_vp9->slice_parameter.seg_param[i].alt_quant;
|
||||
dxvaStructure.stVP9Segments.feature_data[i][1] = pipe_vp9->slice_parameter.seg_param[i].alt_lf;
|
||||
|
||||
@@ -2553,7 +2553,7 @@ d3d12_video_encoder_get_feedback(struct pipe_video_codec *codec,
|
||||
// Copy slices from driver comp_bit_destination into m_nalPrefixTmpBuffer with collated slices NAL prefixes
|
||||
//
|
||||
// Skip SPS, PPS, etc first preEncodeGeneratedHeadersByteSize bytes in src_driver_buffer_read_bytes
|
||||
uint32_t src_driver_buffer_read_bytes = pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].preEncodeGeneratedHeadersByteSize;
|
||||
uint32_t src_driver_buffer_read_bytes = static_cast<uint32_t>(pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].preEncodeGeneratedHeadersByteSize);
|
||||
uint32_t dst_tmp_buffer_written_bytes = 0;
|
||||
uint32_t num_slices = static_cast<uint32_t>(pSubregionsMetadata.size());
|
||||
std::vector<std::vector<uint8_t> > prefix_nal_bufs;
|
||||
@@ -2600,8 +2600,8 @@ d3d12_video_encoder_get_feedback(struct pipe_video_codec *codec,
|
||||
pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].comp_bit_destination, // src
|
||||
0, // src level
|
||||
&src_box);
|
||||
src_driver_buffer_read_bytes += cur_subregion_metadata.bSize;
|
||||
dst_tmp_buffer_written_bytes += cur_subregion_metadata.bSize;
|
||||
src_driver_buffer_read_bytes += static_cast<uint32_t>(cur_subregion_metadata.bSize);
|
||||
dst_tmp_buffer_written_bytes += static_cast<uint32_t>(cur_subregion_metadata.bSize);
|
||||
|
||||
// Insert prefix NAL before current slice in cur_subregion_metadata so it's treated as just another NAL below for reporting metadata
|
||||
pSubregionsMetadata.insert(std::next(pSubregionsMetadata.begin(), 2 * cur_slice_idx), { /* bSize */ written_prefix_nal_bytes, /* bStartOffset */ 0, /* bHeaderSize */ 0 });
|
||||
@@ -2637,7 +2637,7 @@ d3d12_video_encoder_get_feedback(struct pipe_video_codec *codec,
|
||||
pD3D12Enc->base.context->resource_copy_region(pD3D12Enc->base.context, // ctx
|
||||
pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].comp_bit_destination, // dst
|
||||
0, // dst_level
|
||||
pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].preEncodeGeneratedHeadersByteSize,// dstX - Skip the other headers in the final bitstream (e.g SPS, PPS, etc)
|
||||
static_cast<unsigned int>(pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].preEncodeGeneratedHeadersByteSize),// dstX - Skip the other headers in the final bitstream (e.g SPS, PPS, etc)
|
||||
0, // dstY
|
||||
0, // dstZ
|
||||
pD3D12Enc->m_nalPrefixTmpBuffer, // src
|
||||
@@ -2669,12 +2669,12 @@ d3d12_video_encoder_get_feedback(struct pipe_video_codec *codec,
|
||||
unpadded_frame_size += pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].pWrittenCodecUnitsSizes[i];
|
||||
opt_metadata.codec_unit_metadata[opt_metadata.codec_unit_metadata_count].size = pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].pWrittenCodecUnitsSizes[i];
|
||||
opt_metadata.codec_unit_metadata[opt_metadata.codec_unit_metadata_count].offset = *output_buffer_size;
|
||||
*output_buffer_size += pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].pWrittenCodecUnitsSizes[i];
|
||||
*output_buffer_size += static_cast<unsigned int>(pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].pWrittenCodecUnitsSizes[i]);
|
||||
opt_metadata.codec_unit_metadata_count++;
|
||||
}
|
||||
|
||||
// Add padding between pre encode headers (e.g EncodeFrame driver offset alignment) and the first slice
|
||||
*output_buffer_size += pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].preEncodeGeneratedHeadersBytePadding;
|
||||
*output_buffer_size += static_cast<unsigned int>(pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].preEncodeGeneratedHeadersBytePadding);
|
||||
|
||||
debug_printf("D3D12 backend readback submission for frame with fence %" PRIu64 " current_metadata_slot %" PRIu64 " - PictureOrderCountNumber %d FrameType %s num_slice_descriptors %d IRMode %d IRIndex %d\n",
|
||||
requested_metadata_fence,
|
||||
@@ -2692,7 +2692,7 @@ d3d12_video_encoder_get_feedback(struct pipe_video_codec *codec,
|
||||
opt_metadata.codec_unit_metadata[opt_metadata.codec_unit_metadata_count].flags = PIPE_VIDEO_CODEC_UNIT_LOCATION_FLAG_SINGLE_NALU;
|
||||
opt_metadata.codec_unit_metadata[opt_metadata.codec_unit_metadata_count].size = unpadded_slice_size;
|
||||
opt_metadata.codec_unit_metadata[opt_metadata.codec_unit_metadata_count].offset = *output_buffer_size;
|
||||
*output_buffer_size += pSubregionsMetadata[i].bSize;
|
||||
*output_buffer_size += static_cast<unsigned int>(pSubregionsMetadata[i].bSize);
|
||||
if ((pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].expected_max_slice_size > 0) &&
|
||||
(unpadded_slice_size > pD3D12Enc->m_spEncodedFrameMetadata[current_metadata_slot].expected_max_slice_size))
|
||||
opt_metadata.codec_unit_metadata[opt_metadata.codec_unit_metadata_count].flags |= PIPE_VIDEO_CODEC_UNIT_LOCATION_FLAG_MAX_SLICE_SIZE_OVERFLOW;
|
||||
@@ -3005,11 +3005,11 @@ d3d12_video_encoder_update_picparams_region_of_interest_qpmap(struct d3d12_video
|
||||
{
|
||||
uint32_t bucket_start_block_x = cur_region.x / QPMapRegionPixelsSize;
|
||||
uint32_t bucket_start_block_y = cur_region.y / QPMapRegionPixelsSize;
|
||||
uint32_t bucket_end_block_x = std::ceil((cur_region.x + cur_region.width) / static_cast<double>(QPMapRegionPixelsSize)) - 1;
|
||||
uint32_t bucket_end_block_y = std::ceil((cur_region.y + cur_region.height) / static_cast<double>(QPMapRegionPixelsSize)) - 1;
|
||||
uint32_t bucket_end_block_x = static_cast<uint32_t>(std::ceil((cur_region.x + cur_region.width) / static_cast<double>(QPMapRegionPixelsSize)) - 1);
|
||||
uint32_t bucket_end_block_y = static_cast<uint32_t>(std::ceil((cur_region.y + cur_region.height) / static_cast<double>(QPMapRegionPixelsSize)) - 1);
|
||||
for (uint32_t i = bucket_start_block_x; i <= bucket_end_block_x; i++)
|
||||
for (uint32_t j = bucket_start_block_y; j <= bucket_end_block_y; j++)
|
||||
pQPMap[(j * pic_width_in_qpmap_block_units) + i] = CLAMP(cur_region.qp_value, min_delta_qp, max_delta_qp);
|
||||
pQPMap[(j * pic_width_in_qpmap_block_units) + i] = static_cast<T>(CLAMP(cur_region.qp_value, min_delta_qp, max_delta_qp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,7 +509,7 @@ d3d12_video_encoder_negotiate_current_av1_tiles_configuration(struct d3d12_video
|
||||
|
||||
// Copy the tile col sizes (up to 63 defined in VA-API interface array sizes)
|
||||
size_t accum_cols_sb = 0;
|
||||
uint8_t src_cols_count = MIN2(63, pAV1Pic->tile_cols);
|
||||
uint8_t src_cols_count = static_cast<uint8_t>(MIN2(63, pAV1Pic->tile_cols));
|
||||
for (uint8_t i = 0; i < src_cols_count; i++) {
|
||||
tilePartition.ColWidths[i] = pAV1Pic->width_in_sbs_minus_1[i] + 1;
|
||||
accum_cols_sb += tilePartition.ColWidths[i];
|
||||
@@ -522,7 +522,7 @@ d3d12_video_encoder_negotiate_current_av1_tiles_configuration(struct d3d12_video
|
||||
|
||||
// Copy the tile row sizes (up to 63 defined in VA-API interface array sizes)
|
||||
size_t accum_rows_sb = 0;
|
||||
uint8_t src_rows_count = MIN2(63, pAV1Pic->tile_rows);
|
||||
uint8_t src_rows_count = static_cast<uint8_t>(MIN2(63, pAV1Pic->tile_rows));
|
||||
for (uint8_t i = 0; i < src_rows_count; i++) {
|
||||
tilePartition.RowHeights[i] = pAV1Pic->height_in_sbs_minus_1[i] + 1;
|
||||
accum_rows_sb += tilePartition.RowHeights[i];
|
||||
@@ -536,8 +536,8 @@ d3d12_video_encoder_negotiate_current_av1_tiles_configuration(struct d3d12_video
|
||||
// Iterate the tiles and see if they're uniformly partitioned to decide
|
||||
// which D3D12 tile mode to use
|
||||
// Ignore the last row and last col width
|
||||
bool tilesUniform = !D3D12_VIDEO_FORCE_TILE_MODE && util_is_power_of_two_or_zero(tilePartition.RowCount) &&
|
||||
util_is_power_of_two_or_zero(tilePartition.ColCount);
|
||||
bool tilesUniform = !D3D12_VIDEO_FORCE_TILE_MODE && util_is_power_of_two_or_zero(static_cast<uint32_t>(tilePartition.RowCount)) &&
|
||||
util_is_power_of_two_or_zero(static_cast<uint32_t>(tilePartition.ColCount));
|
||||
// Iterate again now that the 63/64 edge case has been handled above.
|
||||
for (uint8_t i = 1; tilesUniform && (i < tilePartition.RowCount - 1) /* Ignore last row */; i++)
|
||||
tilesUniform = tilesUniform && (tilePartition.RowHeights[i - 1] == tilePartition.RowHeights[i]);
|
||||
@@ -551,7 +551,7 @@ d3d12_video_encoder_negotiate_current_av1_tiles_configuration(struct d3d12_video
|
||||
|
||||
assert(pAV1Pic->num_tile_groups <= 128); // ARRAY_SIZE(TilesGroups)
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderSliceConfigDesc.m_TilesConfig_AV1.TilesGroupsCount =
|
||||
pAV1Pic->num_tile_groups;
|
||||
static_cast<uint8_t>(pAV1Pic->num_tile_groups);
|
||||
for (uint8_t i = 0; i < pAV1Pic->num_tile_groups; i++) {
|
||||
pD3D12Enc->m_currentEncodeConfig.m_encoderSliceConfigDesc.m_TilesConfig_AV1.TilesGroups[i].tg_start =
|
||||
pAV1Pic->tile_groups[i].tile_group_start;
|
||||
@@ -1973,8 +1973,8 @@ fill_av1_pic_header(EncodedBitstreamResolvedMetadata &associatedMetadata,
|
||||
|
||||
pic_header->order_hint = associatedMetadata.m_associatedEncodeConfig.m_encoderPicParamsDesc.m_AV1PicData.OrderHint;
|
||||
|
||||
pic_header->refresh_frame_flags =
|
||||
associatedMetadata.m_associatedEncodeConfig.m_encoderPicParamsDesc.m_AV1PicData.RefreshFrameFlags;
|
||||
pic_header->refresh_frame_flags = static_cast<uint8_t>(
|
||||
associatedMetadata.m_associatedEncodeConfig.m_encoderPicParamsDesc.m_AV1PicData.RefreshFrameFlags);
|
||||
|
||||
// frame_size (comes from input texture size)
|
||||
pic_header->FrameWidth = associatedMetadata.m_associatedEncodeConfig.m_currentResolution.Width;
|
||||
@@ -2012,7 +2012,7 @@ fill_av1_pic_header(EncodedBitstreamResolvedMetadata &associatedMetadata,
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < ARRAY_SIZE(pParsedPostEncodeValues->ReferenceIndices); i++)
|
||||
pic_header->ref_frame_idx[i] = pParsedPostEncodeValues->ReferenceIndices[i];
|
||||
pic_header->ref_frame_idx[i] = static_cast<int32_t>(pParsedPostEncodeValues->ReferenceIndices[i]);
|
||||
|
||||
pic_header->allow_high_precision_mv =
|
||||
((associatedMetadata.m_associatedEncodeConfig.m_encoderPicParamsDesc.m_AV1PicData.Flags &
|
||||
@@ -2050,10 +2050,10 @@ fill_av1_pic_header(EncodedBitstreamResolvedMetadata &associatedMetadata,
|
||||
bool lr_enabled =
|
||||
pic_header->lr_params.lr_type[0] || pic_header->lr_params.lr_type[1] || pic_header->lr_params.lr_type[2];
|
||||
if (lr_enabled) {
|
||||
uint8_t luma_shift_total = log2(d3d12_video_encoder_looprestorationsize_d3d12_to_uint_av1(
|
||||
uint8_t luma_shift_total = static_cast<uint8_t>(log2(d3d12_video_encoder_looprestorationsize_d3d12_to_uint_av1(
|
||||
associatedMetadata.m_associatedEncodeConfig.m_encoderPicParamsDesc.m_AV1PicData
|
||||
.FrameRestorationConfig.LoopRestorationPixelSize[0])) -
|
||||
6;
|
||||
6);
|
||||
pic_header->lr_params.lr_unit_shift = (luma_shift_total > 0) ? 1 : 0;
|
||||
pic_header->lr_params.lr_unit_extra_shift = (luma_shift_total > 1) ? 1 : 0;
|
||||
assert(associatedMetadata.m_associatedEncodeConfig.m_encoderPicParamsDesc.m_AV1PicData.FrameRestorationConfig
|
||||
@@ -2062,10 +2062,10 @@ fill_av1_pic_header(EncodedBitstreamResolvedMetadata &associatedMetadata,
|
||||
|
||||
if (associatedMetadata.m_associatedEncodeConfig.m_encoderPicParamsDesc.m_AV1PicData.FrameRestorationConfig
|
||||
.LoopRestorationPixelSize[1]) {
|
||||
pic_header->lr_params.lr_uv_shift = log2(d3d12_video_encoder_looprestorationsize_d3d12_to_uint_av1(
|
||||
pic_header->lr_params.lr_uv_shift = static_cast<uint32_t>(log2(d3d12_video_encoder_looprestorationsize_d3d12_to_uint_av1(
|
||||
associatedMetadata.m_associatedEncodeConfig.m_encoderPicParamsDesc
|
||||
.m_AV1PicData.FrameRestorationConfig.LoopRestorationPixelSize[1])) +
|
||||
6 + luma_shift_total;
|
||||
6 + luma_shift_total);
|
||||
} else {
|
||||
pic_header->lr_params.lr_uv_shift = 0;
|
||||
}
|
||||
@@ -2707,8 +2707,8 @@ d3d12_video_encoder_build_post_encode_codec_bitstream_av1(struct d3d12_video_enc
|
||||
|
||||
uint32_t total_bytes_written = static_cast<uint32_t>(writtenSequenceBytes + writtenTemporalDelimBytes + writtenFrameBytes +
|
||||
writtenTileBytes + extra_show_existing_frame_payload_bytes);
|
||||
assert(std::accumulate(associatedMetadata.pWrittenCodecUnitsSizes.begin(), associatedMetadata.pWrittenCodecUnitsSizes.end(), 0u) ==
|
||||
static_cast<uint64_t>(total_bytes_written));
|
||||
assert(std::accumulate(associatedMetadata.pWrittenCodecUnitsSizes.begin(), associatedMetadata.pWrittenCodecUnitsSizes.end(), 0ull) ==
|
||||
total_bytes_written);
|
||||
return total_bytes_written;
|
||||
}
|
||||
|
||||
@@ -2754,14 +2754,14 @@ upload_tile_group_obu(struct d3d12_video_encoder *pD3D12Enc,
|
||||
staging_bitstream_buffer.data(),
|
||||
staging_bitstream_buffer_offset);
|
||||
|
||||
uint8_t NumTiles = TilesPartition.ColCount * TilesPartition.RowCount;
|
||||
uint8_t NumTiles = static_cast<uint8_t>(TilesPartition.ColCount * TilesPartition.RowCount);
|
||||
bool tile_start_and_end_present_flag = !(tileGroup.tg_start == 0 && (tileGroup.tg_end == (NumTiles - 1)));
|
||||
if (NumTiles > 1)
|
||||
bitstream_tile_group_obu.put_bits(1,
|
||||
tile_start_and_end_present_flag); // tile_start_and_end_present_flag f(1)
|
||||
|
||||
if (!(NumTiles == 1 || !tile_start_and_end_present_flag)) {
|
||||
uint8_t tileBits = log2(TilesPartition.ColCount) + log2(TilesPartition.RowCount);
|
||||
uint8_t tileBits = static_cast<uint8_t>(log2(TilesPartition.ColCount) + log2(TilesPartition.RowCount));
|
||||
bitstream_tile_group_obu.put_bits(tileBits, tileGroup.tg_start); // tg_start f(tileBits)
|
||||
bitstream_tile_group_obu.put_bits(tileBits, tileGroup.tg_end); // tg_end f(tileBits)
|
||||
}
|
||||
|
||||
@@ -756,7 +756,7 @@ d3d12_video_encoder_update_h264_gop_configuration(struct d3d12_video_encoder *pD
|
||||
if (GOPLength == 0) // Use max frame num to wrap on infinite GOPs
|
||||
GOPLength = 1 << (picture->seq.log2_max_frame_num_minus4 + 4);
|
||||
const uint32_t max_pic_order_cnt_lsb = 2 * GOPLength;
|
||||
picture->seq.log2_max_pic_order_cnt_lsb_minus4 = std::max(0.0, std::ceil(std::log2(max_pic_order_cnt_lsb)) - 4);
|
||||
picture->seq.log2_max_pic_order_cnt_lsb_minus4 = static_cast<unsigned int>(std::max(0.0, std::ceil(std::log2(max_pic_order_cnt_lsb)) - 4));
|
||||
assert(picture->seq.log2_max_pic_order_cnt_lsb_minus4 < UCHAR_MAX);
|
||||
}
|
||||
|
||||
@@ -1272,8 +1272,8 @@ d3d12_video_encoder_build_codec_headers_h264(struct d3d12_video_encoder *pD3D12E
|
||||
pD3D12Enc->m_BitstreamHeadersBuffer.resize(writtenAUDBytesCount + writtenSEIBytesCount + writtenSPSBytesCount + writtenPPSBytesCount);
|
||||
}
|
||||
|
||||
assert(std::accumulate(pWrittenCodecUnitsSizes.begin(), pWrittenCodecUnitsSizes.end(), 0u) ==
|
||||
static_cast<uint64_t>(pD3D12Enc->m_BitstreamHeadersBuffer.size()));
|
||||
assert(std::accumulate(pWrittenCodecUnitsSizes.begin(), pWrittenCodecUnitsSizes.end(), 0ull) ==
|
||||
pD3D12Enc->m_BitstreamHeadersBuffer.size());
|
||||
return static_cast<uint32_t>(pD3D12Enc->m_BitstreamHeadersBuffer.size());
|
||||
}
|
||||
|
||||
|
||||
@@ -371,16 +371,16 @@ d3d12_video_encoder_update_current_frame_pic_params_info_hevc(struct d3d12_video
|
||||
// Copy from pipe params
|
||||
//
|
||||
{
|
||||
picParams.pHEVCPicData1->diff_cu_chroma_qp_offset_depth = hevcPic->pic.pps_range_extension.diff_cu_chroma_qp_offset_depth;
|
||||
picParams.pHEVCPicData1->log2_sao_offset_scale_luma = hevcPic->pic.pps_range_extension.log2_sao_offset_scale_luma;
|
||||
picParams.pHEVCPicData1->log2_sao_offset_scale_chroma = hevcPic->pic.pps_range_extension.log2_sao_offset_scale_chroma;
|
||||
picParams.pHEVCPicData1->log2_max_transform_skip_block_size_minus2 = hevcPic->pic.pps_range_extension.log2_max_transform_skip_block_size_minus2;
|
||||
picParams.pHEVCPicData1->chroma_qp_offset_list_len_minus1 = hevcPic->pic.pps_range_extension.chroma_qp_offset_list_len_minus1;
|
||||
picParams.pHEVCPicData1->diff_cu_chroma_qp_offset_depth = static_cast<UCHAR>(hevcPic->pic.pps_range_extension.diff_cu_chroma_qp_offset_depth);
|
||||
picParams.pHEVCPicData1->log2_sao_offset_scale_luma = static_cast<UCHAR>(hevcPic->pic.pps_range_extension.log2_sao_offset_scale_luma);
|
||||
picParams.pHEVCPicData1->log2_sao_offset_scale_chroma = static_cast<UCHAR>(hevcPic->pic.pps_range_extension.log2_sao_offset_scale_chroma);
|
||||
picParams.pHEVCPicData1->log2_max_transform_skip_block_size_minus2 = static_cast<CHAR>(hevcPic->pic.pps_range_extension.log2_max_transform_skip_block_size_minus2);
|
||||
picParams.pHEVCPicData1->chroma_qp_offset_list_len_minus1 = static_cast<CHAR>(hevcPic->pic.pps_range_extension.chroma_qp_offset_list_len_minus1);
|
||||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(picParams.pHEVCPicData1->cb_qp_offset_list) ; i++)
|
||||
{
|
||||
picParams.pHEVCPicData1->cb_qp_offset_list[i] = hevcPic->pic.pps_range_extension.cb_qp_offset_list[i];
|
||||
picParams.pHEVCPicData1->cr_qp_offset_list[i] = hevcPic->pic.pps_range_extension.cr_qp_offset_list[i];
|
||||
picParams.pHEVCPicData1->cb_qp_offset_list[i] = static_cast<CHAR>(hevcPic->pic.pps_range_extension.cb_qp_offset_list[i]);
|
||||
picParams.pHEVCPicData1->cr_qp_offset_list[i] = static_cast<CHAR>(hevcPic->pic.pps_range_extension.cr_qp_offset_list[i]);
|
||||
}
|
||||
|
||||
if (hevcPic->pic.pps_range_extension.cross_component_prediction_enabled_flag)
|
||||
@@ -1425,8 +1425,8 @@ d3d12_video_encoder_build_codec_headers_hevc(struct d3d12_video_encoder *pD3D12E
|
||||
pWrittenCodecUnitsSizes.push_back(writtenAUDBytesCount);
|
||||
}
|
||||
|
||||
uint32_t active_seq_parameter_set_id = pHEVCBitstreamBuilder->get_active_sps().sps_seq_parameter_set_id;
|
||||
uint32_t active_video_parameter_set_id = pHEVCBitstreamBuilder->get_active_vps().vps_video_parameter_set_id;
|
||||
uint8_t active_seq_parameter_set_id = pHEVCBitstreamBuilder->get_active_sps().sps_seq_parameter_set_id;
|
||||
uint8_t active_video_parameter_set_id = pHEVCBitstreamBuilder->get_active_vps().vps_video_parameter_set_id;
|
||||
|
||||
bool writeNewVPS = isFirstFrame || (pD3D12Enc->m_currentEncodeConfig.m_ConfigDirtyFlags & d3d12_video_encoder_config_dirty_flag_video_header);
|
||||
|
||||
@@ -1473,7 +1473,7 @@ d3d12_video_encoder_build_codec_headers_hevc(struct d3d12_video_encoder *pD3D12E
|
||||
size_t writtenPPSBytesCount = 0;
|
||||
HevcPicParameterSet tentative_pps = pHEVCBitstreamBuilder->build_pps(pD3D12Enc->m_currentEncodeConfig.m_encoderCodecSpecificPictureStateDescH265,
|
||||
pHEVCBitstreamBuilder->get_active_sps(),
|
||||
currentPicParams.pHEVCPicData->slice_pic_parameter_set_id,
|
||||
static_cast<uint8_t>(currentPicParams.pHEVCPicData->slice_pic_parameter_set_id),
|
||||
*codecConfigDesc.pHEVCConfig,
|
||||
*currentPicParams.pHEVCPicData1,
|
||||
pD3D12Enc->m_StagingHeadersBuffer,
|
||||
@@ -1497,7 +1497,7 @@ d3d12_video_encoder_build_codec_headers_hevc(struct d3d12_video_encoder *pD3D12E
|
||||
pD3D12Enc->m_BitstreamHeadersBuffer.resize(writtenAUDBytesCount + writtenVPSBytesCount + writtenSPSBytesCount + writtenPPSBytesCount);
|
||||
}
|
||||
|
||||
assert(std::accumulate(pWrittenCodecUnitsSizes.begin(), pWrittenCodecUnitsSizes.end(), 0u) ==
|
||||
static_cast<uint64_t>(pD3D12Enc->m_BitstreamHeadersBuffer.size()));
|
||||
assert(std::accumulate(pWrittenCodecUnitsSizes.begin(), pWrittenCodecUnitsSizes.end(), 0ull) ==
|
||||
pD3D12Enc->m_BitstreamHeadersBuffer.size());
|
||||
return static_cast<uint32_t>(pD3D12Enc->m_BitstreamHeadersBuffer.size());
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ d3d12_video_encoder_bitstream::calculate_su_bits(uint16_t uiBitsCount, int32_t i
|
||||
int16_t mask_sign = 1 << (uiBitsCount - 1);
|
||||
if (iBitsVal & mask_sign)
|
||||
iBitsVal = iBitsVal - 2 * mask_sign;
|
||||
return iBitsVal;
|
||||
return static_cast<uint16_t>(iBitsVal);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -448,11 +448,11 @@ d3d12_video_bitstream_builder_av1::write_pic_data(d3d12_video_encoder_bitstream
|
||||
|
||||
unsigned minLog2TileCols = tile_log2(maxTileWidthSb, pPicHdr->tile_info.tile_support_caps.MinTileCols);
|
||||
unsigned maxLog2TileCols = tile_log2(1, pPicHdr->tile_info.tile_support_caps.MaxTileCols);
|
||||
unsigned log2TileCols = tile_log2(1, pPicHdr->tile_info.tile_partition.ColCount);
|
||||
unsigned log2TileCols = tile_log2(1, static_cast<unsigned>(pPicHdr->tile_info.tile_partition.ColCount));
|
||||
|
||||
unsigned minLog2TileRows = tile_log2(1, pPicHdr->tile_info.tile_support_caps.MinTileRows);
|
||||
unsigned maxLog2TileRows = tile_log2(1, pPicHdr->tile_info.tile_support_caps.MaxTileRows);
|
||||
unsigned log2TileRows = tile_log2(1, pPicHdr->tile_info.tile_partition.RowCount);
|
||||
unsigned log2TileRows = tile_log2(1, static_cast<unsigned>(pPicHdr->tile_info.tile_partition.RowCount));
|
||||
|
||||
pBit->put_bits(1, pPicHdr->tile_info.uniform_tile_spacing_flag); // uniform_tile_spacing_flag
|
||||
|
||||
@@ -470,9 +470,9 @@ d3d12_video_bitstream_builder_av1::write_pic_data(d3d12_video_encoder_bitstream
|
||||
unsigned widestTileSb = 0;
|
||||
unsigned widthSb = pPicHdr->frame_width_sb;
|
||||
for (unsigned i = 0; i < pPicHdr->tile_info.tile_partition.ColCount; i++) {
|
||||
sizeSb = pPicHdr->tile_info.tile_partition.ColWidths[i];
|
||||
sizeSb = static_cast<unsigned>(pPicHdr->tile_info.tile_partition.ColWidths[i]);
|
||||
unsigned maxWidth = std::min(widthSb, maxTileWidthSb);
|
||||
pBit->put_ns_bits(maxWidth, sizeSb - 1); // width_in_sbs_minus_1
|
||||
pBit->put_ns_bits(static_cast<uint16_t>(maxWidth), sizeSb - 1); // width_in_sbs_minus_1
|
||||
widestTileSb = std::max(sizeSb, widestTileSb);
|
||||
widthSb -= sizeSb;
|
||||
}
|
||||
@@ -480,16 +480,16 @@ d3d12_video_bitstream_builder_av1::write_pic_data(d3d12_video_encoder_bitstream
|
||||
unsigned maxTileHeightSb = std::max(maxTileAreaSb / widestTileSb, 1u);
|
||||
unsigned heightSb = pPicHdr->frame_height_sb;
|
||||
for (unsigned i = 0; i < pPicHdr->tile_info.tile_partition.RowCount; i++) {
|
||||
sizeSb = pPicHdr->tile_info.tile_partition.RowHeights[i];
|
||||
sizeSb = static_cast<unsigned int>(pPicHdr->tile_info.tile_partition.RowHeights[i]);
|
||||
unsigned maxHeight = std::min(heightSb, maxTileHeightSb);
|
||||
pBit->put_ns_bits(maxHeight, sizeSb - 1); // height_in_sbs_minus_1
|
||||
pBit->put_ns_bits(static_cast<uint16_t>(maxHeight), sizeSb - 1); // height_in_sbs_minus_1
|
||||
heightSb -= sizeSb;
|
||||
}
|
||||
}
|
||||
|
||||
if (log2TileCols > 0 || log2TileRows > 0) {
|
||||
pBit->put_bits(log2TileRows + log2TileCols,
|
||||
pPicHdr->tile_info.tile_partition.ContextUpdateTileId); // f(TileRowsLog2 + TileColsLog2)
|
||||
static_cast<uint32_t>(pPicHdr->tile_info.tile_partition.ContextUpdateTileId)); // f(TileRowsLog2 + TileColsLog2)
|
||||
pBit->put_bits(2, pPicHdr->tile_info.tile_support_caps.TileSizeBytesMinus1); // tile_size_bytes_minus_1
|
||||
// f(2)
|
||||
}
|
||||
@@ -497,8 +497,8 @@ d3d12_video_bitstream_builder_av1::write_pic_data(d3d12_video_encoder_bitstream
|
||||
|
||||
// quantization_params()
|
||||
{
|
||||
pBit->put_bits(8, pPicHdr->quantization_params.BaseQIndex); // base_q_idx
|
||||
write_delta_q_value(pBit, pPicHdr->quantization_params.YDCDeltaQ);
|
||||
pBit->put_bits(8, static_cast<uint32_t>(pPicHdr->quantization_params.BaseQIndex)); // base_q_idx
|
||||
write_delta_q_value(pBit, static_cast<int32_t>(pPicHdr->quantization_params.YDCDeltaQ));
|
||||
|
||||
bool diff_uv_delta = false;
|
||||
if (pPicHdr->quantization_params.UDCDeltaQ != pPicHdr->quantization_params.VDCDeltaQ ||
|
||||
@@ -511,20 +511,20 @@ d3d12_video_bitstream_builder_av1::write_pic_data(d3d12_video_encoder_bitstream
|
||||
if (pSeqHdr->color_config.separate_uv_delta_q)
|
||||
pBit->put_bits(1, diff_uv_delta);
|
||||
|
||||
write_delta_q_value(pBit, pPicHdr->quantization_params.UDCDeltaQ);
|
||||
write_delta_q_value(pBit, pPicHdr->quantization_params.UACDeltaQ);
|
||||
write_delta_q_value(pBit, static_cast<int32_t>(pPicHdr->quantization_params.UDCDeltaQ));
|
||||
write_delta_q_value(pBit, static_cast<int32_t>(pPicHdr->quantization_params.UACDeltaQ));
|
||||
|
||||
if (diff_uv_delta) {
|
||||
write_delta_q_value(pBit, pPicHdr->quantization_params.VDCDeltaQ);
|
||||
write_delta_q_value(pBit, pPicHdr->quantization_params.VACDeltaQ);
|
||||
write_delta_q_value(pBit, static_cast<int32_t>(pPicHdr->quantization_params.VDCDeltaQ));
|
||||
write_delta_q_value(pBit, static_cast<int32_t>(pPicHdr->quantization_params.VACDeltaQ));
|
||||
}
|
||||
|
||||
pBit->put_bits(1, pPicHdr->quantization_params.UsingQMatrix); // using_qmatrix
|
||||
pBit->put_bits(1, static_cast<uint32_t>(pPicHdr->quantization_params.UsingQMatrix)); // using_qmatrix
|
||||
if (pPicHdr->quantization_params.UsingQMatrix) {
|
||||
pBit->put_bits(4, pPicHdr->quantization_params.QMY); // qm_y
|
||||
pBit->put_bits(4, pPicHdr->quantization_params.QMU); // qm_u
|
||||
pBit->put_bits(4, static_cast<uint32_t>(pPicHdr->quantization_params.QMY)); // qm_y
|
||||
pBit->put_bits(4, static_cast<uint32_t>(pPicHdr->quantization_params.QMU)); // qm_u
|
||||
if (pSeqHdr->color_config.separate_uv_delta_q)
|
||||
pBit->put_bits(4, pPicHdr->quantization_params.QMV); // qm_v
|
||||
pBit->put_bits(4, static_cast<uint32_t>(pPicHdr->quantization_params.QMV)); // qm_v
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,10 +533,10 @@ d3d12_video_bitstream_builder_av1::write_pic_data(d3d12_video_encoder_bitstream
|
||||
pBit->put_bits(1, pPicHdr->segmentation_enabled); // segmentation_enabled
|
||||
if (pPicHdr->segmentation_enabled) {
|
||||
if (pPicHdr->primary_ref_frame != 7 /*PRIMARY_REF_NONE*/) {
|
||||
pBit->put_bits(1, pPicHdr->segmentation_config.UpdateMap); // segmentation_update_map f(1)
|
||||
pBit->put_bits(1, static_cast<uint32_t>(pPicHdr->segmentation_config.UpdateMap)); // segmentation_update_map f(1)
|
||||
if (pPicHdr->segmentation_config.UpdateMap == 1)
|
||||
pBit->put_bits(1, pPicHdr->segmentation_config.TemporalUpdate); // segmentation_temporal_update f(1)
|
||||
pBit->put_bits(1, pPicHdr->segmentation_config.UpdateData); // segmentation_update_data f(1)
|
||||
pBit->put_bits(1, static_cast<uint32_t>(pPicHdr->segmentation_config.TemporalUpdate)); // segmentation_temporal_update f(1)
|
||||
pBit->put_bits(1, static_cast<uint32_t>(pPicHdr->segmentation_config.UpdateData)); // segmentation_update_data f(1)
|
||||
}
|
||||
|
||||
if (pPicHdr->segmentation_config.UpdateData == 1) {
|
||||
@@ -553,12 +553,12 @@ d3d12_video_bitstream_builder_av1::write_pic_data(d3d12_video_encoder_bitstream
|
||||
int bitsToRead = av1_segmentation_feature_bits[j];
|
||||
if (av1_segmentation_feature_signed[j] == 1) {
|
||||
pBit->put_su_bits(
|
||||
1 + bitsToRead,
|
||||
pPicHdr->segmentation_config.SegmentsData[i].FeatureValue[j]); // su(1+bitsToRead)
|
||||
static_cast<uint16_t>(1 + bitsToRead),
|
||||
static_cast<int32_t>(pPicHdr->segmentation_config.SegmentsData[i].FeatureValue[j])); // su(1+bitsToRead)
|
||||
} else {
|
||||
pBit->put_bits(
|
||||
bitsToRead,
|
||||
pPicHdr->segmentation_config.SegmentsData[i].FeatureValue[j]); // f(bitsToRead)
|
||||
static_cast<int32_t>(pPicHdr->segmentation_config.SegmentsData[i].FeatureValue[j])); // f(bitsToRead)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -571,16 +571,16 @@ d3d12_video_bitstream_builder_av1::write_pic_data(d3d12_video_encoder_bitstream
|
||||
// combined with delta_lf_params()
|
||||
{
|
||||
if (pPicHdr->quantization_params.BaseQIndex)
|
||||
pBit->put_bits(1, pPicHdr->delta_q_params.DeltaQPresent); // delta_q_present
|
||||
pBit->put_bits(1, static_cast<uint32_t>(pPicHdr->delta_q_params.DeltaQPresent)); // delta_q_present
|
||||
if (pPicHdr->delta_q_params.DeltaQPresent) {
|
||||
pBit->put_bits(2, pPicHdr->delta_q_params.DeltaQRes); // delta_q_res
|
||||
pBit->put_bits(2, static_cast<uint32_t>(pPicHdr->delta_q_params.DeltaQRes)); // delta_q_res
|
||||
|
||||
// delta_lf_params()
|
||||
if (!pPicHdr->allow_intrabc) {
|
||||
pBit->put_bits(1, pPicHdr->delta_lf_params.DeltaLFPresent); // delta_lf_present
|
||||
pBit->put_bits(1, static_cast<uint32_t>(pPicHdr->delta_lf_params.DeltaLFPresent)); // delta_lf_present
|
||||
if (pPicHdr->delta_lf_params.DeltaLFPresent) {
|
||||
pBit->put_bits(2, pPicHdr->delta_lf_params.DeltaLFRes); // delta_lf_res
|
||||
pBit->put_bits(1, pPicHdr->delta_lf_params.DeltaLFMulti); // delta_lf_multi
|
||||
pBit->put_bits(2, static_cast<uint32_t>(pPicHdr->delta_lf_params.DeltaLFRes)); // delta_lf_res
|
||||
pBit->put_bits(1, static_cast<uint32_t>(pPicHdr->delta_lf_params.DeltaLFMulti)); // delta_lf_multi
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -591,36 +591,36 @@ d3d12_video_bitstream_builder_av1::write_pic_data(d3d12_video_encoder_bitstream
|
||||
// loop_filter_params()
|
||||
{
|
||||
if (!(CodedLossless || pPicHdr->allow_intrabc)) {
|
||||
pBit->put_bits(6, pPicHdr->loop_filter_params.LoopFilterLevel[0]); // loop_filter_level[0]
|
||||
pBit->put_bits(6, pPicHdr->loop_filter_params.LoopFilterLevel[1]); // loop_filter_level[1]
|
||||
pBit->put_bits(6, static_cast<uint32_t>(pPicHdr->loop_filter_params.LoopFilterLevel[0])); // loop_filter_level[0]
|
||||
pBit->put_bits(6, static_cast<uint32_t>(pPicHdr->loop_filter_params.LoopFilterLevel[1])); // loop_filter_level[1]
|
||||
|
||||
if (pPicHdr->loop_filter_params.LoopFilterLevel[0] || pPicHdr->loop_filter_params.LoopFilterLevel[1]) {
|
||||
pBit->put_bits(6, pPicHdr->loop_filter_params.LoopFilterLevelU); // loop_filter_level[2]
|
||||
pBit->put_bits(6, pPicHdr->loop_filter_params.LoopFilterLevelV); // loop_filter_level[3]
|
||||
pBit->put_bits(6, static_cast<uint32_t>(pPicHdr->loop_filter_params.LoopFilterLevelU)); // loop_filter_level[2]
|
||||
pBit->put_bits(6, static_cast<uint32_t>(pPicHdr->loop_filter_params.LoopFilterLevelV)); // loop_filter_level[3]
|
||||
}
|
||||
|
||||
pBit->put_bits(3, pPicHdr->loop_filter_params.LoopFilterSharpnessLevel); // loop_filter_sharpness
|
||||
pBit->put_bits(1, pPicHdr->loop_filter_params.LoopFilterDeltaEnabled); // loop_filter_delta_enabled
|
||||
pBit->put_bits(3, static_cast<uint32_t>(pPicHdr->loop_filter_params.LoopFilterSharpnessLevel)); // loop_filter_sharpness
|
||||
pBit->put_bits(1, static_cast<uint32_t>(pPicHdr->loop_filter_params.LoopFilterDeltaEnabled)); // loop_filter_delta_enabled
|
||||
|
||||
if (pPicHdr->loop_filter_params.LoopFilterDeltaEnabled) {
|
||||
bool loop_filter_delta_update =
|
||||
(pPicHdr->loop_filter_params.UpdateRefDelta || pPicHdr->loop_filter_params.UpdateModeDelta);
|
||||
pBit->put_bits(1, loop_filter_delta_update); // loop_filter_delta_update
|
||||
pBit->put_bits(1, static_cast<uint32_t>(loop_filter_delta_update)); // loop_filter_delta_update
|
||||
if (loop_filter_delta_update) {
|
||||
constexpr uint8_t TOTAL_REFS_PER_FRAME = 8; // From AV1 spec
|
||||
static_assert(ARRAY_SIZE(pPicHdr->loop_filter_params.RefDeltas) == TOTAL_REFS_PER_FRAME);
|
||||
for (uint8_t i = 0; i < TOTAL_REFS_PER_FRAME; i++) {
|
||||
pBit->put_bits(1, pPicHdr->loop_filter_params.UpdateRefDelta); // loop_filter_delta_update
|
||||
pBit->put_bits(1, static_cast<uint32_t>(pPicHdr->loop_filter_params.UpdateRefDelta)); // loop_filter_delta_update
|
||||
if (pPicHdr->loop_filter_params.UpdateRefDelta) {
|
||||
pBit->put_su_bits(7, pPicHdr->loop_filter_params.RefDeltas[i]); // loop_filter_ref_deltas[i]
|
||||
pBit->put_su_bits(7, static_cast<int32_t>(pPicHdr->loop_filter_params.RefDeltas[i])); // loop_filter_ref_deltas[i]
|
||||
}
|
||||
}
|
||||
|
||||
static_assert(ARRAY_SIZE(pPicHdr->loop_filter_params.ModeDeltas) == 2); // From AV1 spec
|
||||
for (uint8_t i = 0; i < 2; i++) {
|
||||
pBit->put_bits(1, pPicHdr->loop_filter_params.UpdateModeDelta); // update_mode_delta
|
||||
pBit->put_bits(1, static_cast<uint32_t>(pPicHdr->loop_filter_params.UpdateModeDelta)); // update_mode_delta
|
||||
if (pPicHdr->loop_filter_params.UpdateModeDelta) {
|
||||
pBit->put_su_bits(7, pPicHdr->loop_filter_params.ModeDeltas[i]); // loop_filter_mode_deltas[i]
|
||||
pBit->put_su_bits(7, static_cast<int32_t>(pPicHdr->loop_filter_params.ModeDeltas[i])); // loop_filter_mode_deltas[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -632,14 +632,14 @@ d3d12_video_bitstream_builder_av1::write_pic_data(d3d12_video_encoder_bitstream
|
||||
{
|
||||
if (!(!pSeqHdr->enable_cdef || CodedLossless || pPicHdr->allow_intrabc)) {
|
||||
uint16_t num_planes = 3; // mono_chrome not supported
|
||||
pBit->put_bits(2, pPicHdr->cdef_params.CdefDampingMinus3); // cdef_damping_minus_3
|
||||
pBit->put_bits(2, pPicHdr->cdef_params.CdefBits); // cdef_bits
|
||||
pBit->put_bits(2, static_cast<uint32_t>(pPicHdr->cdef_params.CdefDampingMinus3)); // cdef_damping_minus_3
|
||||
pBit->put_bits(2, static_cast<uint32_t>(pPicHdr->cdef_params.CdefBits)); // cdef_bits
|
||||
for (uint16_t i = 0; i < (1 << pPicHdr->cdef_params.CdefBits); ++i) {
|
||||
pBit->put_bits(4, pPicHdr->cdef_params.CdefYPriStrength[i]); // cdef_y_pri_strength[i]
|
||||
pBit->put_bits(2, pPicHdr->cdef_params.CdefYSecStrength[i]); // cdef_y_sec_strength[i]
|
||||
pBit->put_bits(4, static_cast<uint32_t>(pPicHdr->cdef_params.CdefYPriStrength[i])); // cdef_y_pri_strength[i]
|
||||
pBit->put_bits(2, static_cast<uint32_t>(pPicHdr->cdef_params.CdefYSecStrength[i])); // cdef_y_sec_strength[i]
|
||||
if (num_planes > 1) {
|
||||
pBit->put_bits(4, pPicHdr->cdef_params.CdefUVPriStrength[i]); // cdef_uv_pri_strength[i]
|
||||
pBit->put_bits(2, pPicHdr->cdef_params.CdefUVSecStrength[i]); // cdef_uv_sec_strength[i]
|
||||
pBit->put_bits(4, static_cast<uint32_t>(pPicHdr->cdef_params.CdefUVPriStrength[i])); // cdef_uv_pri_strength[i]
|
||||
pBit->put_bits(2, static_cast<uint32_t>(pPicHdr->cdef_params.CdefUVSecStrength[i])); // cdef_uv_sec_strength[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -699,22 +699,22 @@ d3d12_video_bitstream_builder_av1::write_pic_data(d3d12_video_encoder_bitstream
|
||||
if (get_relative_dist(refHint,
|
||||
pPicHdr->order_hint,
|
||||
pSeqHdr->order_hint_bits_minus1 + 1,
|
||||
pSeqHdr->enable_order_hint) < 0) {
|
||||
static_cast<uint8_t>(pSeqHdr->enable_order_hint) < 0)) {
|
||||
if (forwardIdx < 0 || get_relative_dist(refHint,
|
||||
forwardHint,
|
||||
pSeqHdr->order_hint_bits_minus1 + 1,
|
||||
pSeqHdr->enable_order_hint) > 0) {
|
||||
static_cast<uint8_t>(pSeqHdr->enable_order_hint)) > 0) {
|
||||
forwardIdx = i;
|
||||
forwardHint = refHint;
|
||||
}
|
||||
} else if (get_relative_dist(refHint,
|
||||
pPicHdr->order_hint,
|
||||
pSeqHdr->order_hint_bits_minus1 + 1,
|
||||
pSeqHdr->enable_order_hint) > 0) {
|
||||
static_cast<uint8_t>(pSeqHdr->enable_order_hint)) > 0) {
|
||||
if (backwardIdx < 0 || get_relative_dist(refHint,
|
||||
backwardHint,
|
||||
pSeqHdr->order_hint_bits_minus1 + 1,
|
||||
pSeqHdr->enable_order_hint) < 0) {
|
||||
static_cast<uint8_t>(pSeqHdr->enable_order_hint) < 0)) {
|
||||
backwardIdx = i;
|
||||
backwardHint = refHint;
|
||||
}
|
||||
@@ -732,11 +732,11 @@ d3d12_video_bitstream_builder_av1::write_pic_data(d3d12_video_encoder_bitstream
|
||||
if (get_relative_dist(refHint,
|
||||
forwardHint,
|
||||
pSeqHdr->order_hint_bits_minus1 + 1,
|
||||
pSeqHdr->enable_order_hint) < 0) {
|
||||
static_cast<uint8_t>(pSeqHdr->enable_order_hint)) < 0) {
|
||||
if (secondForwardIdx < 0 || get_relative_dist(refHint,
|
||||
secondForwardHint,
|
||||
pSeqHdr->order_hint_bits_minus1 + 1,
|
||||
pSeqHdr->enable_order_hint) > 0) {
|
||||
static_cast<uint8_t>(pSeqHdr->enable_order_hint)) > 0) {
|
||||
secondForwardIdx = i;
|
||||
secondForwardHint = refHint;
|
||||
}
|
||||
@@ -864,13 +864,13 @@ d3d12_video_bitstream_builder_av1::calculate_tile_group_obu_size(
|
||||
{
|
||||
size_t tile_group_obu_size_bits = 0;
|
||||
|
||||
uint8_t NumTiles = TilesPartition.ColCount * TilesPartition.RowCount;
|
||||
uint8_t NumTiles = static_cast<uint8_t>(TilesPartition.ColCount * TilesPartition.RowCount);
|
||||
if (NumTiles > 1)
|
||||
tile_group_obu_size_bits++; // tile_start_and_end_present_flag f(1)
|
||||
|
||||
bool tile_start_and_end_present_flag = !(tileGroup.tg_start == 0 && (tileGroup.tg_end == (NumTiles - 1)));
|
||||
if (!(NumTiles == 1 || !tile_start_and_end_present_flag)) {
|
||||
uint8_t tileBits = tile_log2(1, TilesPartition.ColCount) + tile_log2(1, TilesPartition.RowCount);
|
||||
uint8_t tileBits = static_cast<uint8_t>(tile_log2(1, static_cast<uint32_t>(TilesPartition.ColCount)) + tile_log2(1, static_cast<uint32_t>(TilesPartition.RowCount)));
|
||||
tile_group_obu_size_bits += tileBits; // tg_start f(tileBits)
|
||||
tile_group_obu_size_bits += tileBits; // tg_end f(tileBits)
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ convert_profile12_to_stdprofile(D3D12_VIDEO_ENCODER_PROFILE_HEVC profile)
|
||||
void
|
||||
d3d12_video_bitstream_builder_hevc::init_profile_tier_level(HEVCProfileTierLevel *ptl,
|
||||
uint8_t HEVCProfileIdc,
|
||||
uint8_t HEVCLevelIdc,
|
||||
uint32_t HEVCLevelIdc,
|
||||
bool isHighTier)
|
||||
{
|
||||
memset(ptl, 0, sizeof(HEVCProfileTierLevel));
|
||||
@@ -67,7 +67,7 @@ d3d12_video_bitstream_builder_hevc::init_profile_tier_level(HEVCProfileTierLevel
|
||||
ptl->general_interlaced_source_flag = 0; // no
|
||||
ptl->general_non_packed_constraint_flag = 1; // no frame packing arrangement SEI messages
|
||||
ptl->general_frame_only_constraint_flag = 1;
|
||||
ptl->general_level_idc = HEVCLevelIdc;
|
||||
ptl->general_level_idc = static_cast<uint8_t>(HEVCLevelIdc);
|
||||
|
||||
if (ptl->general_profile_idc == 4 /*MAIN444*/)
|
||||
{
|
||||
@@ -476,14 +476,14 @@ d3d12_video_bitstream_builder_hevc::build_sps(const HevcVideoParameterSet& paren
|
||||
m_latest_sps.strong_intra_smoothing_enabled_flag = 0;
|
||||
|
||||
m_latest_sps.vui_parameters_present_flag = seqData.vui_parameters_present_flag;
|
||||
m_latest_sps.vui.aspect_ratio_idc = seqData.aspect_ratio_idc;
|
||||
m_latest_sps.vui.aspect_ratio_idc = static_cast<uint8_t>(seqData.aspect_ratio_idc);
|
||||
m_latest_sps.vui.sar_width = seqData.sar_width;
|
||||
m_latest_sps.vui.sar_height = seqData.sar_height;
|
||||
m_latest_sps.vui.video_format = seqData.video_format;
|
||||
m_latest_sps.vui.video_format = static_cast<uint8_t>(seqData.video_format);
|
||||
m_latest_sps.vui.video_full_range_flag = seqData.video_full_range_flag;
|
||||
m_latest_sps.vui.colour_primaries = seqData.colour_primaries;
|
||||
m_latest_sps.vui.transfer_characteristics = seqData.transfer_characteristics;
|
||||
m_latest_sps.vui.matrix_coeffs = seqData.matrix_coefficients;
|
||||
m_latest_sps.vui.colour_primaries = static_cast<uint8_t>(seqData.colour_primaries);
|
||||
m_latest_sps.vui.transfer_characteristics = static_cast<uint8_t>(seqData.transfer_characteristics);
|
||||
m_latest_sps.vui.matrix_coeffs = static_cast<uint8_t>(seqData.matrix_coefficients);
|
||||
m_latest_sps.vui.chroma_sample_loc_type_top_field = seqData.chroma_sample_loc_type_top_field;
|
||||
m_latest_sps.vui.chroma_sample_loc_type_bottom_field = seqData.chroma_sample_loc_type_bottom_field;
|
||||
m_latest_sps.vui.def_disp_win_left_offset = seqData.def_disp_win_left_offset;
|
||||
@@ -516,7 +516,7 @@ d3d12_video_bitstream_builder_hevc::build_sps(const HevcVideoParameterSet& paren
|
||||
m_latest_sps.vui.motion_vectors_over_pic_boundaries_flag = seqData.vui_flags.motion_vectors_over_pic_boundaries_flag;
|
||||
m_latest_sps.vui.restricted_ref_pic_lists_flag = seqData.vui_flags.restricted_ref_pic_lists_flag;
|
||||
|
||||
m_latest_sps.sps_extension_present_flag = seqData.sps_range_extension.sps_range_extension_flag; // Set sps_extension_present_flag if sps_range_extension_flag present
|
||||
m_latest_sps.sps_extension_present_flag = static_cast<uint8_t>(seqData.sps_range_extension.sps_range_extension_flag); // Set sps_extension_present_flag if sps_range_extension_flag present
|
||||
if (m_latest_sps.sps_extension_present_flag)
|
||||
{
|
||||
m_latest_sps.sps_range_extension.sps_range_extension_flag = seqData.sps_range_extension.sps_range_extension_flag;
|
||||
|
||||
@@ -119,7 +119,7 @@ class d3d12_video_bitstream_builder_hevc : public d3d12_video_bitstream_builder_
|
||||
HevcSeqParameterSet m_active_sps = {};
|
||||
HevcPicParameterSet m_active_pps = {};
|
||||
|
||||
void init_profile_tier_level(HEVCProfileTierLevel *ptl, uint8_t HEVCProfileIdc, uint8_t HEVCLevelIdc, bool isHighTier);
|
||||
void init_profile_tier_level(HEVCProfileTierLevel *ptl, uint8_t HEVCProfileIdc, uint32_t HEVCLevelIdc, bool isHighTier);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -266,8 +266,8 @@ d3d12_video_encode_supported_resolution_range(const D3D12_VIDEO_ENCODER_CODEC &a
|
||||
|
||||
minResolution = capOutputResolutionData.MinResolutionSupported;
|
||||
maxResolution = capOutputResolutionData.MaxResolutionSupported;
|
||||
alignment.bits.log2_width_alignment = std::log2(capOutputResolutionData.ResolutionWidthMultipleRequirement);
|
||||
alignment.bits.log2_height_alignment = std::log2(capOutputResolutionData.ResolutionHeightMultipleRequirement);
|
||||
alignment.bits.log2_width_alignment = static_cast<uint32_t>(std::log2(capOutputResolutionData.ResolutionWidthMultipleRequirement));
|
||||
alignment.bits.log2_height_alignment = static_cast<uint32_t>(std::log2(capOutputResolutionData.ResolutionHeightMultipleRequirement));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -443,8 +443,8 @@ d3d12_video_encode_supported_tile_structures(const D3D12_VIDEO_ENCODER_CODEC &co
|
||||
av1TileSupport.TilesConfiguration.ColCount = std::max(av1TileSupport.MinTileCols, 1u);
|
||||
av1TileSupport.TilesConfiguration.RowCount = std::max(av1TileSupport.MinTileRows, 1u);
|
||||
// Try for uniform grid tiles
|
||||
UINT tileWPixel = capDataTilesSupport.FrameResolution.Width / av1TileSupport.TilesConfiguration.ColCount;
|
||||
UINT tileHPixel = capDataTilesSupport.FrameResolution.Height / av1TileSupport.TilesConfiguration.RowCount;
|
||||
UINT tileWPixel = static_cast<UINT>(capDataTilesSupport.FrameResolution.Width / av1TileSupport.TilesConfiguration.ColCount);
|
||||
UINT tileHPixel = static_cast<UINT>(capDataTilesSupport.FrameResolution.Height / av1TileSupport.TilesConfiguration.RowCount);
|
||||
for (UINT i = 0; i < av1TileSupport.TilesConfiguration.ColCount; i++)
|
||||
av1TileSupport.TilesConfiguration.ColWidths[i] = (tileWPixel / superBlockSize);
|
||||
for (UINT j = 0; j < av1TileSupport.TilesConfiguration.RowCount; j++)
|
||||
@@ -1019,8 +1019,8 @@ d3d12_has_video_encode_support(struct pipe_screen *pscreen,
|
||||
|
||||
uint8_t minCuSize = d3d12_video_encoder_convert_12cusize_to_pixel_size_hevc(codecSupport.hevc_support.d3d12_caps.MinLumaCodingUnitSize);
|
||||
uint8_t maxCuSize = d3d12_video_encoder_convert_12cusize_to_pixel_size_hevc(codecSupport.hevc_support.d3d12_caps.MaxLumaCodingUnitSize);
|
||||
uint8_t MinCbLog2SizeY = std::log2(minCuSize);
|
||||
uint8_t CtbLog2SizeY = std::log2(maxCuSize);
|
||||
uint8_t MinCbLog2SizeY = static_cast<uint8_t>(std::log2(minCuSize));
|
||||
uint8_t CtbLog2SizeY = static_cast<uint8_t>(std::log2(maxCuSize));
|
||||
uint8_t minTuSize = d3d12_video_encoder_convert_12tusize_to_pixel_size_hevc(codecSupport.hevc_support.d3d12_caps.MinLumaTransformUnitSize);
|
||||
uint8_t maxTuSize = d3d12_video_encoder_convert_12tusize_to_pixel_size_hevc(codecSupport.hevc_support.d3d12_caps.MaxLumaTransformUnitSize);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user