From 8f26b414fa7e718ca65ebd6be42b4babde4039f6 Mon Sep 17 00:00:00 2001 From: Hu Gang Date: Tue, 28 Sep 2010 11:35:53 +0300 Subject: [PATCH] photography: extend photography iface Add more color tone modes and add NoseReduction settings. Fixes #616814. --- docs/plugins/gst-plugins-bad-plugins-sections.txt | 3 ++ gst-libs/gst/interfaces/photography.c | 26 +++++++++++++ gst-libs/gst/interfaces/photography.h | 45 ++++++++++++++++++++++- gst/camerabin/gstcamerabin-enum.h | 1 + 4 files changed, 74 insertions(+), 1 deletion(-) diff --git a/docs/plugins/gst-plugins-bad-plugins-sections.txt b/docs/plugins/gst-plugins-bad-plugins-sections.txt index b1f5679..e232c97 100644 --- a/docs/plugins/gst-plugins-bad-plugins-sections.txt +++ b/docs/plugins/gst-plugins-bad-plugins-sections.txt @@ -1722,6 +1722,7 @@ GST_TYPE_ZBAR gstphotography GstPhotography GstPhotography +GstPhotographyNoiseReduction GstWhiteBalanceMode GstColourToneMode GstSceneMode @@ -1741,6 +1742,7 @@ gst_photography_get_white_balance_mode gst_photography_get_colour_tone_mode gst_photography_get_scene_mode gst_photography_get_flash_mode +gst_photography_get_noise_reduction gst_photography_get_zoom gst_photography_set_ev_compensation gst_photography_set_iso_speed @@ -1750,6 +1752,7 @@ gst_photography_set_white_balance_mode gst_photography_set_colour_tone_mode gst_photography_set_scene_mode gst_photography_set_flash_mode +gst_photography_set_noise_reduction gst_photography_set_zoom gst_photography_get_capabilities gst_photography_prepare_for_capture diff --git a/gst-libs/gst/interfaces/photography.c b/gst-libs/gst/interfaces/photography.c index 8b470d6..6fcf0d9 100644 --- a/gst-libs/gst/interfaces/photography.c +++ b/gst-libs/gst/interfaces/photography.c @@ -81,6 +81,7 @@ gst_photography_iface_base_init (GstPhotographyInterface * iface) iface->get_colour_tone_mode = NULL; iface->get_scene_mode = NULL; iface->get_flash_mode = NULL; + iface->get_noise_reduction = NULL; iface->get_zoom = NULL; iface->get_flicker_mode = NULL; iface->get_focus_mode = NULL; @@ -93,6 +94,7 @@ gst_photography_iface_base_init (GstPhotographyInterface * iface) iface->set_colour_tone_mode = NULL; iface->set_scene_mode = NULL; iface->set_flash_mode = NULL; + iface->set_noise_reduction = NULL; iface->set_zoom = NULL; iface->set_flicker_mode = NULL; iface->set_focus_mode = NULL; @@ -290,6 +292,30 @@ GST_PHOTOGRAPHY_FUNC_TEMPLATE (scene_mode, GstSceneMode); GST_PHOTOGRAPHY_FUNC_TEMPLATE (flash_mode, GstFlashMode); /** + * gst_photography_set_noise_reduction: + * @photo: #GstPhotography interface of a #GstElement + * @noise_reduction: #GstNoiseReductionMode to set + * + * Set the noise reduction mode for the #GstElement + * + * Returns: %TRUE if setting the value succeeded, %FALSE otherwise + * + * Since: 0.10.21 + */ +/** + * gst_photography_get_noise_reduction: + * @photo: #GstPhotography interface of a #GstElement + * @noise_reduction: #GstNoiseReductionMode to get + * + * Get the noise reduction mode for the #GstElement + * + * Returns: %TRUE if getting the value succeeded, %FALSE otherwise + * + * Since: 0.10.21 + */ +GST_PHOTOGRAPHY_FUNC_TEMPLATE (noise_reduction, guint); + +/** * gst_photography_set_zoom: * @photo: #GstPhotography interface of a #GstElement * @zoom: zoom value to set diff --git a/gst-libs/gst/interfaces/photography.h b/gst-libs/gst/interfaces/photography.h index e7e4f20..002503b 100644 --- a/gst-libs/gst/interfaces/photography.h +++ b/gst-libs/gst/interfaces/photography.h @@ -56,6 +56,7 @@ G_BEGIN_DECLS #define GST_PHOTOGRAPHY_PROP_COLOUR_TONE "colour-tone-mode" #define GST_PHOTOGRAPHY_PROP_SCENE_MODE "scene-mode" #define GST_PHOTOGRAPHY_PROP_FLASH_MODE "flash-mode" +#define GST_PHOTOGRAPHY_PROP_NOISE_REDUCTION "noise-reduction" #define GST_PHOTOGRAPHY_PROP_FOCUS_STATUS "focus-status" #define GST_PHOTOGRAPHY_PROP_CAPABILITIES "capabilities" #define GST_PHOTOGRAPHY_PROP_SHAKE_RISK "shake-risk" @@ -78,6 +79,34 @@ G_BEGIN_DECLS */ typedef struct _GstPhotography GstPhotography; +/** + * GstPhotographyNoiseReduction: + * @GST_PHOTOGRAPHY_NOISE_REDUCTION_BAYER: Adaptive noise reduction on Bayer + * format + * @GST_PHOTOGRAPHY_NOISE_REDUCTION_YCC: reduces the noise on Y and 2-chroma + * images. + * @GST_PHOTOGRAPHY_NOISE_REDUCTION_TEMPORAL: Multi-frame adaptive NR, + * provided for the video mode + * @GST_PHOTOGRAPHY_NOISE_REDUCTION_FPN: Fixed Pattern Noise refers to noise + * that does not change between frames. The noise is removed from the sensor + * image, by subtracting a previously-captured black image in memory. + * @GST_PHOTOGRAPHY_NOISE_REDUCTION_EXTRA: Extra Noise Reduction. In the case + * of high-ISO capturing, some noise remains after YCC NR. XNR reduces this + * remaining noise. + * + * Noise Reduction features of a photography capture or filter element. + * + * Since: 0.10.21 + */ +typedef enum +{ + GST_PHOTOGRAPHY_NOISE_REDUCTION_BAYER = ( 1<<0 ), + GST_PHOTOGRAPHY_NOISE_REDUCTION_YCC = ( 1<<1 ), + GST_PHOTOGRAPHY_NOISE_REDUCTION_TEMPORAL= ( 1<< 2), + GST_PHOTOGRAPHY_NOISE_REDUCTION_FIXED = (1 << 3), + GST_PHOTOGRAPHY_NOISE_REDUCTION_EXTRA = (1 << 4) +} GstPhotographyNoiseReduction; + typedef enum { GST_PHOTOGRAPHY_WB_MODE_AUTO = 0, @@ -98,7 +127,10 @@ typedef enum GST_PHOTOGRAPHY_COLOUR_TONE_MODE_VIVID, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_COLORSWAP, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SOLARIZE, - GST_PHOTOGRAPHY_COLOUR_TONE_MODE_OUT_OF_FOCUS + GST_PHOTOGRAPHY_COLOUR_TONE_MODE_OUT_OF_FOCUS, + GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SKY_BLUE, + GST_PHOTOGRAPHY_COLOUR_TONE_MODE_GRASS_GREEN, + GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SKIN_WHITEN } GstColourToneMode; typedef enum @@ -177,6 +209,7 @@ typedef struct GstColourToneMode tone_mode; GstSceneMode scene_mode; GstFlashMode flash_mode; + guint noise_reduction; guint32 exposure; guint aperture; gfloat ev_compensation; @@ -209,6 +242,7 @@ typedef void (*GstPhotoCapturePrepared) (gpointer data, * @get_colour_tone_mode: vmethod to get colour tone mode value * @get_scene_mode: vmethod to get scene mode value * @get_flash_mode: vmethod to get flash mode value + * @get_noise_reduction: vmethod to get noise reduction mode value * @get_zoom: vmethod to get zoom factor value * @set_ev_compensation: vmethod to set ev exposure compensation value * @set_iso_speed: vmethod to set iso speed (light sensitivity) value @@ -218,6 +252,7 @@ typedef void (*GstPhotoCapturePrepared) (gpointer data, * @set_colour_tone_mode: vmethod to set colour tone mode value * @set_scene_mode: vmethod to set scene mode value * @set_flash_mode: vmethod to set flash mode value + * @set_noise_reduction: vmethod to set noise reduction mode value * @set_zoom: vmethod to set zoom factor value * @get_capabilities: vmethod to get supported capabilities of the interface * @prepare_for_capture: vmethod to tell the element to prepare for capturing @@ -245,6 +280,8 @@ typedef struct _GstPhotographyInterface GstSceneMode * scene_mode); gboolean (*get_flash_mode) (GstPhotography * photo, GstFlashMode * flash_mode); + gboolean (*get_noise_reduction) (GstPhotography * photo, + guint * noise_reduction); gboolean (*get_zoom) (GstPhotography * photo, gfloat * zoom); gboolean (*get_flicker_mode) (GstPhotography * photo, GstFlickerReductionMode * flicker_mode); @@ -263,6 +300,8 @@ typedef struct _GstPhotographyInterface GstSceneMode scene_mode); gboolean (*set_flash_mode) (GstPhotography * photo, GstFlashMode flash_mode); + gboolean (*set_noise_reduction) (GstPhotography * photo, + guint noise_reduction); gboolean (*set_zoom) (GstPhotography * photo, gfloat zoom); gboolean (*set_flicker_mode) (GstPhotography * photo, GstFlickerReductionMode flicker_mode); @@ -299,6 +338,8 @@ gboolean gst_photography_get_scene_mode (GstPhotography * photo, GstSceneMode * scene_mode); gboolean gst_photography_get_flash_mode (GstPhotography * photo, GstFlashMode * flash_mode); +gboolean gst_photography_get_noise_reduction (GstPhotography * photo, + guint * noise_reduction); gboolean gst_photography_get_zoom (GstPhotography * photo, gfloat * zoom); gboolean gst_photography_get_flicker_mode (GstPhotography * photo, GstFlickerReductionMode *mode); @@ -319,6 +360,8 @@ gboolean gst_photography_set_scene_mode (GstPhotography * photo, GstSceneMode scene_mode); gboolean gst_photography_set_flash_mode (GstPhotography * photo, GstFlashMode flash_mode); +gboolean gst_photography_set_noise_reduction (GstPhotography * photo, + guint noise_reduction); gboolean gst_photography_set_zoom (GstPhotography * photo, gfloat zoom); gboolean gst_photography_set_flicker_mode (GstPhotography * photo, GstFlickerReductionMode mode); diff --git a/gst/camerabin/gstcamerabin-enum.h b/gst/camerabin/gstcamerabin-enum.h index 747828a..9cbe889 100644 --- a/gst/camerabin/gstcamerabin-enum.h +++ b/gst/camerabin/gstcamerabin-enum.h @@ -61,6 +61,7 @@ enum ARG_VIEWFINDER_FILTER, ARG_FLICKER_MODE, ARG_FOCUS_MODE, + ARG_NOISE_REDUCTION, ARG_BLOCK_VIEWFINDER, ARG_IMAGE_CAPTURE_WIDTH, ARG_IMAGE_CAPTURE_HEIGHT, -- 2.7.4