mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
alpha: Remove some unneeded calculations and instance struct fields
And document the instance struct fields a bit better
This commit is contained in:
parent
6b0c535e8d
commit
46025bbd8f
2 changed files with 14 additions and 14 deletions
|
@ -737,17 +737,17 @@ gst_alpha_chroma_key_i420 (const guint8 * src, guint8 * dest, gint width,
|
|||
static void
|
||||
gst_alpha_init_params (GstAlpha * alpha)
|
||||
{
|
||||
float kgl;
|
||||
float tmp;
|
||||
float tmp1, tmp2;
|
||||
gfloat kgl;
|
||||
gfloat tmp;
|
||||
gfloat tmp1, tmp2;
|
||||
gfloat y;
|
||||
const gint *matrix;
|
||||
|
||||
matrix =
|
||||
(alpha->out_sdtv) ? cog_rgb_to_ycbcr_matrix_8bit_sdtv :
|
||||
cog_rgb_to_ycbcr_matrix_8bit_hdtv;
|
||||
|
||||
alpha->y =
|
||||
(matrix[0] * ((gint) alpha->target_r) +
|
||||
y = (matrix[0] * ((gint) alpha->target_r) +
|
||||
matrix[1] * ((gint) alpha->target_g) +
|
||||
matrix[2] * ((gint) alpha->target_b) + matrix[3]) >> 8;
|
||||
/* Cb,Cr without offset here because the chroma keying
|
||||
|
@ -766,8 +766,6 @@ gst_alpha_init_params (GstAlpha * alpha)
|
|||
alpha->cb = 127 * (tmp1 / kgl);
|
||||
alpha->cr = 127 * (tmp2 / kgl);
|
||||
|
||||
alpha->accept_angle_cos = cos (M_PI * alpha->angle / 180);
|
||||
alpha->accept_angle_sin = sin (M_PI * alpha->angle / 180);
|
||||
tmp = 15 * tan (M_PI * alpha->angle / 180);
|
||||
tmp = MIN (tmp, 255);
|
||||
alpha->accept_angle_tg = tmp;
|
||||
|
@ -776,7 +774,7 @@ gst_alpha_init_params (GstAlpha * alpha)
|
|||
alpha->accept_angle_ctg = tmp;
|
||||
tmp = 1 / (kgl);
|
||||
alpha->one_over_kc = 255 * 2 * tmp - 255;
|
||||
tmp = 15 * (float) (alpha->y) / kgl;
|
||||
tmp = 15 * y / kgl;
|
||||
tmp = MIN (tmp, 255);
|
||||
alpha->kfgy_scale = tmp;
|
||||
alpha->kg = MIN (kgl, 127);
|
||||
|
|
|
@ -60,11 +60,14 @@ struct _GstAlpha
|
|||
{
|
||||
GstVideoFilter parent;
|
||||
|
||||
/* <private> */
|
||||
|
||||
/* caps */
|
||||
GstVideoFormat in_format, out_format;
|
||||
gint width, height;
|
||||
gboolean in_sdtv, out_sdtv;
|
||||
|
||||
/* properties */
|
||||
gdouble alpha;
|
||||
|
||||
guint target_r;
|
||||
|
@ -75,21 +78,20 @@ struct _GstAlpha
|
|||
|
||||
gfloat angle;
|
||||
gfloat noise_level;
|
||||
guint noise_level2;
|
||||
guint black_sensitivity;
|
||||
guint white_sensitivity;
|
||||
|
||||
gfloat y; /* chroma color */
|
||||
/* processing function */
|
||||
void (*process) (const guint8 *src, guint8 *dest, gint width, gint height, GstAlpha *alpha);
|
||||
|
||||
/* precalculated values for chroma keying */
|
||||
gint8 cb, cr;
|
||||
gint8 kg;
|
||||
gfloat accept_angle_cos;
|
||||
gfloat accept_angle_sin;
|
||||
guint8 accept_angle_tg;
|
||||
guint8 accept_angle_ctg;
|
||||
guint8 one_over_kc;
|
||||
guint8 kfgy_scale;
|
||||
|
||||
void (*process) (const guint8 *src, guint8 *dest, gint width, gint height, GstAlpha *alpha);
|
||||
guint noise_level2;
|
||||
};
|
||||
|
||||
struct _GstAlphaClass
|
||||
|
|
Loading…
Reference in a new issue