swscale/ops: realign after adding slice_align

This is a separate commit since it makes it easier to see the changes.

Sponsored-by: Sovereign Tech Fund
This commit is contained in:
Lynne 2026-02-23 22:29:22 +01:00
parent 9c51aa1824
commit 00907e1244
No known key found for this signature in database
GPG key ID: A2FEA5F03F034464
5 changed files with 21 additions and 19 deletions

View file

@ -976,7 +976,8 @@ static void op_pass_setup(const SwsImg *out_base, const SwsImg *in_base,
const int plane_w = (aligned_w + sub_x) >> sub_x;
const int plane_pad = (comp->over_read + sub_x) >> sub_x;
const int plane_size = plane_w * p->pixel_bits_in >> 3;
p->memcpy_in |= plane_size + plane_pad > in.linesize[i];
if (comp->slice_align)
p->memcpy_in |= plane_size + plane_pad > in.linesize[i];
exec->in_stride[i] = in.linesize[i];
}
@ -986,7 +987,8 @@ static void op_pass_setup(const SwsImg *out_base, const SwsImg *in_base,
const int plane_w = (aligned_w + sub_x) >> sub_x;
const int plane_pad = (comp->over_write + sub_x) >> sub_x;
const int plane_size = plane_w * p->pixel_bits_out >> 3;
p->memcpy_out |= plane_size + plane_pad > out.linesize[i];
if (comp->slice_align)
p->memcpy_out |= plane_size + plane_pad > out.linesize[i];
exec->out_stride[i] = out.linesize[i];
}

View file

@ -77,10 +77,10 @@ static int compile(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out)
*out = (SwsCompiledOp) {
.slice_align = 1,
.block_size = SWS_BLOCK_SIZE,
.cpu_flags = chain->cpu_flags,
.priv = chain,
.free = ff_sws_op_chain_free_cb,
.block_size = SWS_BLOCK_SIZE,
.cpu_flags = chain->cpu_flags,
.priv = chain,
.free = ff_sws_op_chain_free_cb,
};
switch (read_type) {

View file

@ -95,10 +95,10 @@ typedef struct SwsCompiledOp {
SwsOpFunc func;
int slice_align; /* slice height alignment */
int block_size; /* number of pixels processed per iteration */
int over_read; /* implementation over-reads input by this many bytes */
int over_write; /* implementation over-writes output by this many bytes */
int cpu_flags; /* active set of CPU flags (informative) */
int block_size; /* number of pixels processed per iteration */
int over_read; /* implementation over-reads input by this many bytes */
int over_write; /* implementation over-writes output by this many bytes */
int cpu_flags; /* active set of CPU flags (informative) */
/* Arbitrary private data */
void *priv;

View file

@ -119,7 +119,7 @@ static int compile(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out)
*out = (SwsCompiledOp) {
.slice_align = 1,
.block_size = 1,
.block_size = 1,
.func = process,
.priv = av_memdup(&p, sizeof(p)),
.free = av_free,

View file

@ -596,15 +596,15 @@ static int solve_shuffle(const SwsOpList *ops, int mmsize, SwsCompiledOp *out)
mmsize; /* movu */
*out = (SwsCompiledOp) {
.priv = av_memdup(shuffle, sizeof(shuffle)),
.free = av_free,
.priv = av_memdup(shuffle, sizeof(shuffle)),
.free = av_free,
.slice_align = 1,
.block_size = pixels * num_lanes,
.over_read = read_size - in_total,
.over_write = mmsize - out_total,
.cpu_flags = mmsize > 32 ? AV_CPU_FLAG_AVX512 :
mmsize > 16 ? AV_CPU_FLAG_AVX2 :
AV_CPU_FLAG_SSE4,
.block_size = pixels * num_lanes,
.over_read = read_size - in_total,
.over_write = mmsize - out_total,
.cpu_flags = mmsize > 32 ? AV_CPU_FLAG_AVX512 :
mmsize > 16 ? AV_CPU_FLAG_AVX2 :
AV_CPU_FLAG_SSE4,
};
if (!out->priv)