mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-01-10 16:15:39 +01:00
avfilter/vf_overlay: rename variables for clarity
`is_straight`, `alpha_mode` etc. are more consistently named to refer to either the main image, or the overlay.
This commit is contained in:
@@ -370,7 +370,7 @@ static int config_output(AVFilterLink *outlink)
|
||||
static av_always_inline void blend_slice_packed_rgb(AVFilterContext *ctx,
|
||||
AVFrame *dst, const AVFrame *src,
|
||||
int main_has_alpha, int x, int y,
|
||||
int is_straight, int jobnr, int nb_jobs)
|
||||
int overlay_straight, int jobnr, int nb_jobs)
|
||||
{
|
||||
OverlayContext *s = ctx->priv;
|
||||
int i, imax, j, jmax;
|
||||
@@ -427,11 +427,11 @@ static av_always_inline void blend_slice_packed_rgb(AVFilterContext *ctx,
|
||||
default:
|
||||
// main_value = main_value * (1 - alpha) + overlay_value * alpha
|
||||
// since alpha is in the range 0-255, the result must divided by 255
|
||||
d[dr] = is_straight ? FAST_DIV255(d[dr] * (255 - alpha) + S[sr] * alpha) :
|
||||
d[dr] = overlay_straight ? FAST_DIV255(d[dr] * (255 - alpha) + S[sr] * alpha) :
|
||||
FFMIN(FAST_DIV255(d[dr] * (255 - alpha)) + S[sr], 255);
|
||||
d[dg] = is_straight ? FAST_DIV255(d[dg] * (255 - alpha) + S[sg] * alpha) :
|
||||
d[dg] = overlay_straight ? FAST_DIV255(d[dg] * (255 - alpha) + S[sg] * alpha) :
|
||||
FFMIN(FAST_DIV255(d[dg] * (255 - alpha)) + S[sg], 255);
|
||||
d[db] = is_straight ? FAST_DIV255(d[db] * (255 - alpha) + S[sb] * alpha) :
|
||||
d[db] = overlay_straight ? FAST_DIV255(d[db] * (255 - alpha) + S[sb] * alpha) :
|
||||
FFMIN(FAST_DIV255(d[db] * (255 - alpha)) + S[sb], 255);
|
||||
}
|
||||
if (main_has_alpha) {
|
||||
@@ -465,7 +465,7 @@ static av_always_inline void blend_plane_##depth##_##nbits##bits(AVFilterContext
|
||||
int dst_plane, \
|
||||
int dst_offset, \
|
||||
int dst_step, \
|
||||
int straight, \
|
||||
int overlay_straight, \
|
||||
int yuv, \
|
||||
int jobnr, \
|
||||
int nb_jobs) \
|
||||
@@ -545,7 +545,7 @@ static av_always_inline void blend_plane_##depth##_##nbits##bits(AVFilterContext
|
||||
alpha_d = da[0]; \
|
||||
alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d); \
|
||||
} \
|
||||
if (straight) { \
|
||||
if (overlay_straight) { \
|
||||
if (nbits > 8) \
|
||||
*d = (*d * (max - alpha) + *s * alpha) / max; \
|
||||
else \
|
||||
@@ -633,7 +633,7 @@ static av_always_inline void blend_slice_yuv_##depth##_##nbits##bits(AVFilterCon
|
||||
int hsub, int vsub, \
|
||||
int main_has_alpha, \
|
||||
int x, int y, \
|
||||
int is_straight, \
|
||||
int overlay_straight, \
|
||||
int jobnr, int nb_jobs) \
|
||||
{ \
|
||||
OverlayContext *s = ctx->priv; \
|
||||
@@ -644,13 +644,13 @@ static av_always_inline void blend_slice_yuv_##depth##_##nbits##bits(AVFilterCon
|
||||
\
|
||||
blend_plane_##depth##_##nbits##bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, \
|
||||
x, y, main_has_alpha, s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, \
|
||||
s->main_desc->comp[0].step, is_straight, 1, jobnr, nb_jobs); \
|
||||
s->main_desc->comp[0].step, overlay_straight, 1, jobnr, nb_jobs); \
|
||||
blend_plane_##depth##_##nbits##bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, \
|
||||
x, y, main_has_alpha, s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, \
|
||||
s->main_desc->comp[1].step, is_straight, 1, jobnr, nb_jobs); \
|
||||
s->main_desc->comp[1].step, overlay_straight, 1, jobnr, nb_jobs); \
|
||||
blend_plane_##depth##_##nbits##bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, \
|
||||
x, y, main_has_alpha, s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, \
|
||||
s->main_desc->comp[2].step, is_straight, 1, jobnr, nb_jobs); \
|
||||
s->main_desc->comp[2].step, overlay_straight, 1, jobnr, nb_jobs); \
|
||||
\
|
||||
if (main_has_alpha) \
|
||||
alpha_composite_##depth##_##nbits##bits(src, dst, src_w, src_h, dst_w, dst_h, x, y, \
|
||||
@@ -664,7 +664,7 @@ static av_always_inline void blend_slice_planar_rgb(AVFilterContext *ctx,
|
||||
int hsub, int vsub,
|
||||
int main_has_alpha,
|
||||
int x, int y,
|
||||
int is_straight,
|
||||
int overlay_straight,
|
||||
int jobnr,
|
||||
int nb_jobs)
|
||||
{
|
||||
@@ -675,13 +675,13 @@ static av_always_inline void blend_slice_planar_rgb(AVFilterContext *ctx,
|
||||
const int dst_h = dst->height;
|
||||
|
||||
blend_plane_8_8bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, x, y, main_has_alpha,
|
||||
s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, s->main_desc->comp[1].step, is_straight, 0,
|
||||
s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, s->main_desc->comp[1].step, overlay_straight, 0,
|
||||
jobnr, nb_jobs);
|
||||
blend_plane_8_8bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, x, y, main_has_alpha,
|
||||
s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, s->main_desc->comp[2].step, is_straight, 0,
|
||||
s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, s->main_desc->comp[2].step, overlay_straight, 0,
|
||||
jobnr, nb_jobs);
|
||||
blend_plane_8_8bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, x, y, main_has_alpha,
|
||||
s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, s->main_desc->comp[0].step, is_straight, 0,
|
||||
s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, s->main_desc->comp[0].step, overlay_straight, 0,
|
||||
jobnr, nb_jobs);
|
||||
|
||||
if (main_has_alpha)
|
||||
|
||||
@@ -83,6 +83,6 @@ typedef struct OverlayContext {
|
||||
} OverlayContext;
|
||||
|
||||
void ff_overlay_init_x86(OverlayContext *s, int format, int pix_format,
|
||||
enum AVAlphaMode, int main_has_alpha);
|
||||
enum AVAlphaMode overlay_alpha, int main_has_alpha);
|
||||
|
||||
#endif /* AVFILTER_OVERLAY_H */
|
||||
|
||||
@@ -33,14 +33,14 @@ int ff_overlay_row_22_sse4(uint8_t *d, uint8_t *da, uint8_t *s, uint8_t *a,
|
||||
int w, ptrdiff_t alinesize);
|
||||
|
||||
av_cold void ff_overlay_init_x86(OverlayContext *s, int format, int pix_format,
|
||||
enum AVAlphaMode alpha_mode, int main_has_alpha)
|
||||
enum AVAlphaMode overlay_alpha, int main_has_alpha)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (EXTERNAL_SSE4(cpu_flags) &&
|
||||
(format == OVERLAY_FORMAT_YUV444 ||
|
||||
format == OVERLAY_FORMAT_GBRP) &&
|
||||
alpha_mode != AVALPHA_MODE_PREMULTIPLIED && main_has_alpha == 0) {
|
||||
overlay_alpha != AVALPHA_MODE_PREMULTIPLIED && main_has_alpha == 0) {
|
||||
s->blend_row[0] = ff_overlay_row_44_sse4;
|
||||
s->blend_row[1] = ff_overlay_row_44_sse4;
|
||||
s->blend_row[2] = ff_overlay_row_44_sse4;
|
||||
@@ -49,7 +49,7 @@ av_cold void ff_overlay_init_x86(OverlayContext *s, int format, int pix_format,
|
||||
if (EXTERNAL_SSE4(cpu_flags) &&
|
||||
(pix_format == AV_PIX_FMT_YUV420P) &&
|
||||
(format == OVERLAY_FORMAT_YUV420) &&
|
||||
alpha_mode != AVALPHA_MODE_PREMULTIPLIED && main_has_alpha == 0) {
|
||||
overlay_alpha != AVALPHA_MODE_PREMULTIPLIED && main_has_alpha == 0) {
|
||||
s->blend_row[0] = ff_overlay_row_44_sse4;
|
||||
s->blend_row[1] = ff_overlay_row_20_sse4;
|
||||
s->blend_row[2] = ff_overlay_row_20_sse4;
|
||||
@@ -57,7 +57,7 @@ av_cold void ff_overlay_init_x86(OverlayContext *s, int format, int pix_format,
|
||||
|
||||
if (EXTERNAL_SSE4(cpu_flags) &&
|
||||
(format == OVERLAY_FORMAT_YUV422) &&
|
||||
alpha_mode != AVALPHA_MODE_PREMULTIPLIED && main_has_alpha == 0) {
|
||||
overlay_alpha != AVALPHA_MODE_PREMULTIPLIED && main_has_alpha == 0) {
|
||||
s->blend_row[0] = ff_overlay_row_44_sse4;
|
||||
s->blend_row[1] = ff_overlay_row_22_sse4;
|
||||
s->blend_row[2] = ff_overlay_row_22_sse4;
|
||||
|
||||
Reference in New Issue
Block a user