mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-03 09:12:19 +00:00
monoscope: replace hardcoded values by constants
This at least establishes the relationship.
This commit is contained in:
parent
8d17911b33
commit
292d44316e
1 changed files with 13 additions and 10 deletions
|
@ -53,11 +53,15 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||||
GST_STATIC_CAPS ("video/x-raw, "
|
GST_STATIC_CAPS ("video/x-raw, "
|
||||||
"format = (string) xRGB, "
|
"format = (string) xRGB, "
|
||||||
"width = 256, " "height = 128, " "framerate = " GST_VIDEO_FPS_RANGE)
|
"width = " G_STRINGIFY (scope_width) ", "
|
||||||
|
"height = " G_STRINGIFY (scope_height) ", "
|
||||||
|
"framerate = " GST_VIDEO_FPS_RANGE)
|
||||||
#else
|
#else
|
||||||
GST_STATIC_CAPS ("video/x-raw, "
|
GST_STATIC_CAPS ("video/x-raw, "
|
||||||
"format = (string) BGRx, "
|
"format = (string) BGRx, "
|
||||||
"width = 256, " "height = 128, " "framerate = " GST_VIDEO_FPS_RANGE)
|
"width = " G_STRINGIFY (scope_width) ", "
|
||||||
|
"height = " G_STRINGIFY (scope_height) ", "
|
||||||
|
"framerate = " GST_VIDEO_FPS_RANGE)
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -133,8 +137,8 @@ gst_monoscope_init (GstMonoscope * monoscope)
|
||||||
monoscope->bps = sizeof (gint16);
|
monoscope->bps = sizeof (gint16);
|
||||||
|
|
||||||
/* reset the initial video state */
|
/* reset the initial video state */
|
||||||
monoscope->width = 256;
|
monoscope->width = scope_width;
|
||||||
monoscope->height = 128;
|
monoscope->height = scope_height;
|
||||||
monoscope->fps_num = 25; /* desired frame rate */
|
monoscope->fps_num = 25; /* desired frame rate */
|
||||||
monoscope->fps_denom = 1;
|
monoscope->fps_denom = 1;
|
||||||
monoscope->visstate = NULL;
|
monoscope->visstate = NULL;
|
||||||
|
@ -398,13 +402,12 @@ gst_monoscope_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf)
|
||||||
|
|
||||||
samples = (gint16 *) gst_adapter_map (monoscope->adapter, bytesperframe);
|
samples = (gint16 *) gst_adapter_map (monoscope->adapter, bytesperframe);
|
||||||
|
|
||||||
if (monoscope->spf < 512) {
|
if (monoscope->spf < convolver_big) {
|
||||||
gint16 in_data[512], i;
|
gint16 in_data[convolver_big], i;
|
||||||
|
gdouble scale = (gdouble) monoscope->spf / (gdouble) convolver_big;
|
||||||
|
|
||||||
for (i = 0; i < 512; ++i) {
|
for (i = 0; i < convolver_big; ++i) {
|
||||||
gdouble off;
|
gdouble off = (gdouble) i * scale;
|
||||||
|
|
||||||
off = ((gdouble) i * (gdouble) monoscope->spf) / 512.0;
|
|
||||||
in_data[i] = samples[MIN ((guint) off, monoscope->spf)];
|
in_data[i] = samples[MIN ((guint) off, monoscope->spf)];
|
||||||
}
|
}
|
||||||
pixels = monoscope_update (monoscope->visstate, in_data);
|
pixels = monoscope_update (monoscope->visstate, in_data);
|
||||||
|
|
Loading…
Reference in a new issue