tag: Adds GST_TAG_CAPTURING_SHARPNESS

Adds new tag for tagging sharpness processing used
when capturing an image. Also maps it in the exif
tags.

Tests included.

API: GST_TAG_CAPTURING_SHARPNESS

https://bugzilla.gnome.org/show_bug.cgi?id=631773
This commit is contained in:
Thiago Santos 2010-10-08 15:14:22 -03:00 committed by Tim-Philipp Müller
parent f396a37fc5
commit f67e7aacf3
7 changed files with 75 additions and 6 deletions

View file

@ -1666,6 +1666,7 @@ GST_TAG_CAPTURING_GAIN_ADJUSTMENT
GST_TAG_CAPTURING_WHITE_BALANCE GST_TAG_CAPTURING_WHITE_BALANCE
GST_TAG_CAPTURING_CONTRAST GST_TAG_CAPTURING_CONTRAST
GST_TAG_CAPTURING_SATURATION GST_TAG_CAPTURING_SATURATION
GST_TAG_CAPTURING_SHARPNESS
GST_TAG_CAPTURING_FLASH_FIRED GST_TAG_CAPTURING_FLASH_FIRED
GST_TAG_CAPTURING_FLASH_MODE GST_TAG_CAPTURING_FLASH_MODE
GST_TAG_IMAGE_HORIZONTAL_PPI GST_TAG_IMAGE_HORIZONTAL_PPI

View file

@ -238,6 +238,7 @@ EXIF_SERIALIZATION_DESERIALIZATION_FUNC (orientation);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (saturation); EXIF_SERIALIZATION_DESERIALIZATION_FUNC (saturation);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (scene_capture_type); EXIF_SERIALIZATION_DESERIALIZATION_FUNC (scene_capture_type);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (sensitivity_type); EXIF_SERIALIZATION_DESERIALIZATION_FUNC (sensitivity_type);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (sharpness);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (shutter_speed); EXIF_SERIALIZATION_DESERIALIZATION_FUNC (shutter_speed);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (speed); EXIF_SERIALIZATION_DESERIALIZATION_FUNC (speed);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (white_balance); EXIF_SERIALIZATION_DESERIALIZATION_FUNC (white_balance);
@ -293,6 +294,7 @@ EXIF_DESERIALIZATION_FUNC (add_to_pending_tags);
#define EXIF_TAG_GAIN_CONTROL 0xA407 #define EXIF_TAG_GAIN_CONTROL 0xA407
#define EXIF_TAG_CONTRAST 0xA408 #define EXIF_TAG_CONTRAST 0xA408
#define EXIF_TAG_SATURATION 0xA409 #define EXIF_TAG_SATURATION 0xA409
#define EXIF_TAG_SHARPNESS 0xA40A
/* IFD pointer tags */ /* IFD pointer tags */
#define EXIF_IFD_TAG 0x8769 #define EXIF_IFD_TAG 0x8769
@ -390,6 +392,8 @@ static const GstExifTagMatch tag_map_exif[] = {
serialize_contrast, deserialize_contrast}, serialize_contrast, deserialize_contrast},
{GST_TAG_CAPTURING_SATURATION, EXIF_TAG_SATURATION, EXIF_TYPE_SHORT, 0, {GST_TAG_CAPTURING_SATURATION, EXIF_TAG_SATURATION, EXIF_TYPE_SHORT, 0,
serialize_saturation, deserialize_saturation}, serialize_saturation, deserialize_saturation},
{GST_TAG_CAPTURING_SHARPNESS, EXIF_TAG_SHARPNESS, EXIF_TYPE_SHORT, 0,
serialize_sharpness, deserialize_sharpness},
{NULL, 0, 0, 0, NULL, NULL} {NULL, 0, 0, 0, NULL, NULL}
}; };
@ -1761,6 +1765,8 @@ EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (saturation,
capturing_saturation); capturing_saturation);
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (scene_capture_type, EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (scene_capture_type,
capturing_scene_capture_type); capturing_scene_capture_type);
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (sharpness,
capturing_sharpness);
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (white_balance, EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (white_balance,
capturing_white_balance); capturing_white_balance);

View file

@ -277,8 +277,9 @@ __exif_tag_capturing_white_balance_from_exif_value (gint value)
} }
} }
gint static gint
__exif_tag_capturing_contrast_to_exif_value (const gchar * str) __exif_tag_capturing_contrast_sharpness_to_exif_value (const gchar * str,
const gchar * tag_name)
{ {
if (str == NULL) if (str == NULL)
goto end; goto end;
@ -291,12 +292,13 @@ __exif_tag_capturing_contrast_to_exif_value (const gchar * str)
return 2; return 2;
end: end:
GST_WARNING ("Invalid contrast type: %s", str); GST_WARNING ("Invalid %s type: %s", tag_name, str);
return -1; return -1;
} }
const gchar * static const gchar *
__exif_tag_capturing_contrast_from_exif_value (gint value) __exif_tag_capturing_contrast_sharpness_from_exif_value (gint value,
const gchar * tag_name)
{ {
switch (value) { switch (value) {
case 0: case 0:
@ -306,11 +308,25 @@ __exif_tag_capturing_contrast_from_exif_value (gint value)
case 2: case 2:
return "hard"; return "hard";
default: default:
GST_WARNING ("Invalid contrast type: %d", value); GST_WARNING ("Invalid %s type: %d", tag_name, value);
return NULL; return NULL;
} }
} }
gint
__exif_tag_capturing_contrast_to_exif_value (const gchar * str)
{
return __exif_tag_capturing_contrast_sharpness_to_exif_value (str,
"contrast");
}
const gchar *
__exif_tag_capturing_contrast_from_exif_value (gint value)
{
return __exif_tag_capturing_contrast_sharpness_from_exif_value (value,
"contrast");
}
gint gint
__exif_tag_capturing_saturation_to_exif_value (const gchar * str) __exif_tag_capturing_saturation_to_exif_value (const gchar * str)
{ {
@ -344,3 +360,17 @@ __exif_tag_capturing_saturation_from_exif_value (gint value)
return NULL; return NULL;
} }
} }
gint
__exif_tag_capturing_sharpness_to_exif_value (const gchar * str)
{
return __exif_tag_capturing_contrast_sharpness_to_exif_value (str,
"sharpness");
}
const gchar *
__exif_tag_capturing_sharpness_from_exif_value (gint value)
{
return __exif_tag_capturing_contrast_sharpness_from_exif_value (value,
"sharpness");
}

View file

@ -59,6 +59,9 @@ const gchar * __exif_tag_capturing_contrast_from_exif_value (gint value);
gint __exif_tag_capturing_saturation_to_exif_value (const gchar * str); gint __exif_tag_capturing_saturation_to_exif_value (const gchar * str);
const gchar * __exif_tag_capturing_saturation_from_exif_value (gint value); const gchar * __exif_tag_capturing_saturation_from_exif_value (gint value);
gint __exif_tag_capturing_sharpness_to_exif_value (const gchar * str);
const gchar * __exif_tag_capturing_sharpness_from_exif_value (gint value);
G_END_DECLS G_END_DECLS
#endif /* __GST_TAG_EDIT_PRIVATE_H__ */ #endif /* __GST_TAG_EDIT_PRIVATE_H__ */

View file

@ -280,6 +280,20 @@ G_BEGIN_DECLS
*/ */
#define GST_TAG_CAPTURING_SATURATION "capturing-saturation" #define GST_TAG_CAPTURING_SATURATION "capturing-saturation"
/**
* GST_TAG_CAPTURING_SHARPNESS:
*
* Direction of sharpness processing applied when capturing an image. (string)
*
* The allowed values are:
* "normal"
* "soft"
* "hard"
*
* Since: 0.10.31
*/
#define GST_TAG_CAPTURING_SHARPNESS "capturing-sharpness"
/** /**
* GST_TAG_CAPTURING_FLASH_FIRED: * GST_TAG_CAPTURING_FLASH_FIRED:
* *

View file

@ -155,6 +155,11 @@ gst_tag_register_tags_internal (gpointer unused)
_("The direction of saturation processing applied when " _("The direction of saturation processing applied when "
"capturing an image"), NULL); "capturing an image"), NULL);
gst_tag_register (GST_TAG_CAPTURING_SHARPNESS, GST_TAG_FLAG_META,
G_TYPE_STRING, _("capturing sharpness"),
_("The direction of sharpness processing applied "
"when capturing an image"), NULL);
gst_tag_register (GST_TAG_CAPTURING_FLASH_FIRED, GST_TAG_FLAG_META, gst_tag_register (GST_TAG_CAPTURING_FLASH_FIRED, GST_TAG_FLAG_META,
G_TYPE_BOOLEAN, _("capturing flash fired"), G_TYPE_BOOLEAN, _("capturing flash fired"),
_("If the flash fired while capturing and image"), NULL); _("If the flash fired while capturing and image"), NULL);

View file

@ -1384,6 +1384,16 @@ GST_START_TEST (test_exif_tags_serialization_deserialization)
g_value_set_static_string (&value, "high-saturation"); g_value_set_static_string (&value, "high-saturation");
do_simple_exif_tag_serialization_deserialization do_simple_exif_tag_serialization_deserialization
(GST_TAG_CAPTURING_SATURATION, &value); (GST_TAG_CAPTURING_SATURATION, &value);
g_value_set_static_string (&value, "normal");
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_SHARPNESS,
&value);
g_value_set_static_string (&value, "hard");
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_SHARPNESS,
&value);
g_value_set_static_string (&value, "soft");
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_SHARPNESS,
&value);
g_value_unset (&value); g_value_unset (&value);
g_value_init (&value, G_TYPE_DOUBLE); g_value_init (&value, G_TYPE_DOUBLE);