avdeinterlace: fix element leak
[platform/upstream/gstreamer.git] / subprojects / gst-libav / ext / libav / gstavcfg.c
1 /* GStreamer
2  *
3  * FFMpeg Configuration
4  *
5  * Copyright (C) <2006> Mark Nauwelaerts <manauw@skynet.be>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22
23
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
27
28 #include "gstav.h"
29 #include "gstavvidenc.h"
30 #include "gstavcfg.h"
31
32 #include <string.h>
33 #include <libavutil/opt.h>
34
35 static GQuark avoption_quark;
36 static GHashTable *generic_overrides = NULL;
37
38 static void
39 make_generic_overrides (void)
40 {
41   g_assert (!generic_overrides);
42   generic_overrides = g_hash_table_new_full (g_str_hash, g_str_equal,
43       g_free, (GDestroyNotify) gst_structure_free);
44
45   g_hash_table_insert (generic_overrides, g_strdup ("b"),
46       gst_structure_new_empty ("bitrate"));
47   g_hash_table_insert (generic_overrides, g_strdup ("ab"),
48       gst_structure_new_empty ("bitrate"));
49   g_hash_table_insert (generic_overrides, g_strdup ("g"),
50       gst_structure_new_empty ("gop-size"));
51   g_hash_table_insert (generic_overrides, g_strdup ("bt"),
52       gst_structure_new_empty ("bitrate-tolerance"));
53   g_hash_table_insert (generic_overrides, g_strdup ("bf"),
54       gst_structure_new_empty ("max-bframes"));
55
56   /* Those are exposed through caps */
57   g_hash_table_insert (generic_overrides, g_strdup ("profile"),
58       gst_structure_new ("profile", "skip", G_TYPE_BOOLEAN, TRUE, NULL));
59   g_hash_table_insert (generic_overrides, g_strdup ("level"),
60       gst_structure_new ("level", "skip", G_TYPE_BOOLEAN, TRUE, NULL));
61   g_hash_table_insert (generic_overrides, g_strdup ("color_primaries"),
62       gst_structure_new ("color_primaries", "skip", G_TYPE_BOOLEAN, TRUE,
63           NULL));
64   g_hash_table_insert (generic_overrides, g_strdup ("color_trc"),
65       gst_structure_new ("color_trc", "skip", G_TYPE_BOOLEAN, TRUE, NULL));
66   g_hash_table_insert (generic_overrides, g_strdup ("colorspace"),
67       gst_structure_new ("colorspace", "skip", G_TYPE_BOOLEAN, TRUE, NULL));
68   g_hash_table_insert (generic_overrides, g_strdup ("color_range"),
69       gst_structure_new ("color_range", "skip", G_TYPE_BOOLEAN, TRUE, NULL));
70 }
71
72 void
73 gst_ffmpeg_cfg_init (void)
74 {
75   avoption_quark = g_quark_from_static_string ("ffmpeg-cfg-param-spec-data");
76   make_generic_overrides ();
77 }
78
79 static gint
80 cmp_enum_value (GEnumValue * val1, GEnumValue * val2)
81 {
82   if (val1->value == val2->value)
83     return 0;
84   return (val1->value > val2->value) ? 1 : -1;
85 }
86
87 static GType
88 register_enum (const AVClass ** obj, const AVOption * top_opt)
89 {
90   const AVOption *opt = NULL;
91   GType res = 0;
92   GArray *values;
93   gchar *lower_obj_name = g_ascii_strdown ((*obj)->class_name, -1);
94   gchar *enum_name = g_strdup_printf ("%s-%s", lower_obj_name, top_opt->unit);
95   gboolean none_default = TRUE;
96   const gchar *enum_name_strip;
97
98   g_strcanon (enum_name, G_CSET_a_2_z G_CSET_DIGITS, '-');
99
100   /* strip leading '-'s */
101   enum_name_strip = enum_name;
102   while (enum_name_strip[0] == '-')
103     enum_name_strip++;
104
105   if (enum_name_strip[0] == '\0')
106     goto done;
107
108   if ((res = g_type_from_name (enum_name_strip)))
109     goto done;
110
111   values = g_array_new (TRUE, TRUE, sizeof (GEnumValue));
112
113   while ((opt = av_opt_next (obj, opt))) {
114     if (opt->type == AV_OPT_TYPE_CONST && !g_strcmp0 (top_opt->unit, opt->unit)) {
115       GEnumValue val;
116
117       val.value = opt->default_val.i64;
118       val.value_name = g_strdup (opt->help ? opt->help : opt->name);
119       val.value_nick = g_strdup (opt->name);
120
121       if (opt->default_val.i64 == top_opt->default_val.i64)
122         none_default = FALSE;
123
124       g_array_append_val (values, val);
125     }
126   }
127
128   if (values->len) {
129     guint i = 0;
130     gint cur_val;
131     gboolean cur_val_set = FALSE;
132
133     /* Sometimes ffmpeg sets a default value but no named constants with
134      * this value, we assume this means "unspecified" and add our own
135      */
136     if (none_default) {
137       GEnumValue val;
138
139       val.value = top_opt->default_val.i64;
140       val.value_name = g_strdup ("Unspecified");
141       val.value_nick = g_strdup ("unknown");
142       g_array_append_val (values, val);
143     }
144
145     g_array_sort (values, (GCompareFunc) cmp_enum_value);
146
147     /* Dedup, easy once sorted
148      * We do this because ffmpeg can expose multiple names for the
149      * same constant, the way we expose enums makes this too confusing.
150      */
151     while (i < values->len) {
152       if (cur_val_set) {
153         if (g_array_index (values, GEnumValue, i).value == cur_val) {
154           GEnumValue val = g_array_index (values, GEnumValue, i);
155           /* Don't leak the strings */
156           g_free ((gchar *) val.value_name);
157           g_free ((gchar *) val.value_nick);
158           g_array_remove_index (values, i);
159         } else {
160           cur_val = g_array_index (values, GEnumValue, i).value;
161           i++;
162         }
163       } else {
164         cur_val = g_array_index (values, GEnumValue, i).value;
165         cur_val_set = TRUE;
166         i++;
167       }
168     }
169
170     res = g_enum_register_static (enum_name_strip,
171         &g_array_index (values, GEnumValue, 0));
172
173     gst_type_mark_as_plugin_api (res, 0);
174
175     g_array_free (values, FALSE);
176   } else {
177     g_array_free (values, TRUE);
178   }
179
180 done:
181   g_free (lower_obj_name);
182   g_free (enum_name);
183   return res;
184 }
185
186 static gint
187 cmp_flags_value (GFlagsValue * val1, GFlagsValue * val2)
188 {
189   if (val1->value == val2->value)
190     return 0;
191   return (val1->value > val2->value) ? 1 : -1;
192 }
193
194 static GType
195 register_flags (const AVClass ** obj, const AVOption * top_opt)
196 {
197   const AVOption *opt = NULL;
198   GType res = 0;
199   GArray *values;
200   gchar *lower_obj_name = g_ascii_strdown ((*obj)->class_name, -1);
201   gchar *flags_name = g_strdup_printf ("%s-%s", lower_obj_name, top_opt->unit);
202   const gchar *flags_name_strip;
203
204   g_strcanon (flags_name, G_CSET_a_2_z G_CSET_DIGITS, '-');
205
206   /* strip leading '-'s */
207   flags_name_strip = flags_name;
208   while (flags_name_strip[0] == '-')
209     flags_name_strip++;
210
211   if (flags_name_strip[0] == '\0')
212     goto done;
213
214   if ((res = g_type_from_name (flags_name_strip)))
215     goto done;
216
217   values = g_array_new (TRUE, TRUE, sizeof (GFlagsValue));
218
219   while ((opt = av_opt_next (obj, opt))) {
220     if (opt->type == AV_OPT_TYPE_CONST && !g_strcmp0 (top_opt->unit, opt->unit)) {
221       GFlagsValue val;
222
223       /* We expose pass manually, hardcoding this isn't very nice, but
224        * I don't expect we want to do that sort of things often enough
225        * to warrant a general mechanism
226        */
227       if (!g_strcmp0 (top_opt->name, "flags")) {
228         if (opt->default_val.i64 == AV_CODEC_FLAG_QSCALE ||
229             opt->default_val.i64 == AV_CODEC_FLAG_PASS1 ||
230             opt->default_val.i64 == AV_CODEC_FLAG_PASS2) {
231           continue;
232         }
233       }
234
235       val.value = opt->default_val.i64;
236       val.value_name = g_strdup (opt->help ? opt->help : opt->name);
237       val.value_nick = g_strdup (opt->name);
238
239       g_array_append_val (values, val);
240     }
241   }
242
243   if (values->len) {
244     g_array_sort (values, (GCompareFunc) cmp_flags_value);
245
246     res =
247         g_flags_register_static (flags_name_strip, &g_array_index (values,
248             GFlagsValue, 0));
249
250     gst_type_mark_as_plugin_api (res, 0);
251     g_array_free (values, FALSE);
252   } else
253     g_array_free (values, TRUE);
254
255 done:
256   g_free (lower_obj_name);
257   g_free (flags_name);
258   return res;
259 }
260
261 static guint
262 install_opts (GObjectClass * gobject_class, const AVClass ** obj, guint prop_id,
263     gint flags, const gchar * extra_help, GHashTable * overrides)
264 {
265   const AVOption *opt = NULL;
266
267   while ((opt = av_opt_next (obj, opt))) {
268     GParamSpec *pspec = NULL;
269     AVOptionRanges *r;
270     gdouble min = G_MINDOUBLE;
271     gdouble max = G_MAXDOUBLE;
272     gchar *help;
273     const gchar *name;
274
275     if (overrides && g_hash_table_contains (overrides, opt->name)) {
276       gboolean skip;
277       const GstStructure *s =
278           (GstStructure *) g_hash_table_lookup (overrides, opt->name);
279
280       name = gst_structure_get_name (s);
281       if (gst_structure_get_boolean (s, "skip", &skip) && skip) {
282         continue;
283       }
284     } else {
285       name = opt->name;
286     }
287
288     if ((opt->flags & flags) != flags)
289       continue;
290
291     if (g_object_class_find_property (gobject_class, name))
292       continue;
293
294     if (av_opt_query_ranges (&r, obj, opt->name, AV_OPT_SEARCH_FAKE_OBJ) >= 0) {
295       if (r->nb_ranges == 1) {
296         min = r->range[0]->value_min;
297         max = r->range[0]->value_max;
298       }
299       av_opt_freep_ranges (&r);
300     }
301
302     help = g_strdup_printf ("%s%s", opt->help, extra_help);
303
304     switch (opt->type) {
305       case AV_OPT_TYPE_INT:
306         if (opt->unit) {
307           GType enum_gtype;
308           enum_gtype = register_enum (obj, opt);
309
310           if (enum_gtype) {
311             pspec = g_param_spec_enum (name, name, help,
312                 enum_gtype, opt->default_val.i64, G_PARAM_READWRITE);
313             g_object_class_install_property (gobject_class, prop_id++, pspec);
314           } else {              /* Some options have a unit but no named constants associated */
315             pspec = g_param_spec_int (name, name, help,
316                 (gint) min, (gint) max, opt->default_val.i64,
317                 G_PARAM_READWRITE);
318             g_object_class_install_property (gobject_class, prop_id++, pspec);
319           }
320         } else {
321           pspec = g_param_spec_int (name, name, help,
322               (gint) min, (gint) max, opt->default_val.i64, G_PARAM_READWRITE);
323           g_object_class_install_property (gobject_class, prop_id++, pspec);
324         }
325         break;
326       case AV_OPT_TYPE_FLAGS:
327         if (opt->unit) {
328           GType flags_gtype;
329           flags_gtype = register_flags (obj, opt);
330
331           if (flags_gtype) {
332             pspec = g_param_spec_flags (name, name, help,
333                 flags_gtype, opt->default_val.i64, G_PARAM_READWRITE);
334             g_object_class_install_property (gobject_class, prop_id++, pspec);
335           }
336         }
337         break;
338       case AV_OPT_TYPE_DURATION:       /* Fall through */
339       case AV_OPT_TYPE_INT64:
340         /* FIXME 2.0: Workaround for worst property related API change. We
341          * continue using a 32 bit integer for the bitrate property as
342          * otherwise too much existing code will fail at runtime.
343          *
344          * See https://gitlab.freedesktop.org/gstreamer/gst-libav/issues/41#note_142808 */
345         if (g_strcmp0 (name, "bitrate") == 0) {
346           pspec = g_param_spec_int (name, name, help,
347               (gint) MAX (min, G_MININT), (gint) MIN (max, G_MAXINT),
348               (gint) opt->default_val.i64, G_PARAM_READWRITE);
349         } else {
350           /* ffmpeg expresses all ranges with doubles, this is sad */
351           pspec = g_param_spec_int64 (name, name, help,
352               (min == (gdouble) INT64_MIN ? INT64_MIN : (gint64) min),
353               (max == (gdouble) INT64_MAX ? INT64_MAX : (gint64) max),
354               opt->default_val.i64, G_PARAM_READWRITE);
355         }
356         g_object_class_install_property (gobject_class, prop_id++, pspec);
357         break;
358       case AV_OPT_TYPE_DOUBLE:
359         pspec = g_param_spec_double (name, name, help,
360             min, max, opt->default_val.dbl, G_PARAM_READWRITE);
361         g_object_class_install_property (gobject_class, prop_id++, pspec);
362         break;
363       case AV_OPT_TYPE_FLOAT:
364         pspec = g_param_spec_float (name, name, help,
365             (gfloat) min, (gfloat) max, (gfloat) opt->default_val.dbl,
366             G_PARAM_READWRITE);
367         g_object_class_install_property (gobject_class, prop_id++, pspec);
368         break;
369       case AV_OPT_TYPE_STRING:
370         pspec = g_param_spec_string (name, name, help,
371             opt->default_val.str, G_PARAM_READWRITE);
372         g_object_class_install_property (gobject_class, prop_id++, pspec);
373         break;
374       case AV_OPT_TYPE_UINT64:
375         /* ffmpeg expresses all ranges with doubles, this is appalling */
376         pspec = g_param_spec_uint64 (name, name, help,
377             (guint64) (min <= (gdouble) 0 ? 0 : (guint64) min),
378             (guint64) (max >=
379                 /* Biggest value before UINT64_MAX that can be represented as double */
380                 (gdouble) 18446744073709550000.0 ?
381                 /* The Double conversion rounds UINT64_MAX to a bigger */
382                 /* value, so the following smaller limit must be used. */
383                 G_GUINT64_CONSTANT (18446744073709550000) : (guint64) max),
384             opt->default_val.i64, G_PARAM_READWRITE);
385         g_object_class_install_property (gobject_class, prop_id++, pspec);
386         break;
387       case AV_OPT_TYPE_BOOL:
388         pspec = g_param_spec_boolean (name, name, help,
389             opt->default_val.i64 ? TRUE : FALSE, G_PARAM_READWRITE);
390         g_object_class_install_property (gobject_class, prop_id++, pspec);
391         break;
392         /* TODO: didn't find options for the video encoders with
393          * the following type, add support if needed */
394       case AV_OPT_TYPE_CHANNEL_LAYOUT:
395       case AV_OPT_TYPE_COLOR:
396       case AV_OPT_TYPE_VIDEO_RATE:
397       case AV_OPT_TYPE_SAMPLE_FMT:
398       case AV_OPT_TYPE_PIXEL_FMT:
399       case AV_OPT_TYPE_IMAGE_SIZE:
400       case AV_OPT_TYPE_DICT:
401       case AV_OPT_TYPE_BINARY:
402       case AV_OPT_TYPE_RATIONAL:
403       default:
404         break;
405     }
406
407     g_free (help);
408
409     if (pspec) {
410       g_param_spec_set_qdata (pspec, avoption_quark, (gpointer) opt);
411     }
412   }
413
414   return prop_id;
415 }
416
417 void
418 gst_ffmpeg_cfg_install_properties (GObjectClass * klass, AVCodec * in_plugin,
419     guint base, gint flags)
420 {
421   gint prop_id;
422   AVCodecContext *ctx;
423
424   prop_id = base;
425   g_return_if_fail (base > 0);
426
427   ctx = avcodec_alloc_context3 (in_plugin);
428   if (!ctx)
429     g_warning ("could not get context");
430
431   prop_id =
432       install_opts ((GObjectClass *) klass, &in_plugin->priv_class, prop_id, 0,
433       " (Private codec option)", NULL);
434   prop_id =
435       install_opts ((GObjectClass *) klass, &ctx->av_class, prop_id, flags,
436       " (Generic codec option, might have no effect)", generic_overrides);
437
438   if (ctx) {
439     gst_ffmpeg_avcodec_close (ctx);
440     av_free (ctx);
441   }
442 }
443
444 static gint
445 set_option_value (AVCodecContext * ctx, GParamSpec * pspec,
446     const GValue * value, const AVOption * opt)
447 {
448   int res = -1;
449
450   switch (G_PARAM_SPEC_VALUE_TYPE (pspec)) {
451     case G_TYPE_INT:
452       res = av_opt_set_int (ctx, opt->name,
453           g_value_get_int (value), AV_OPT_SEARCH_CHILDREN);
454       break;
455     case G_TYPE_INT64:
456       res = av_opt_set_int (ctx, opt->name,
457           g_value_get_int64 (value), AV_OPT_SEARCH_CHILDREN);
458       break;
459     case G_TYPE_UINT64:
460       res = av_opt_set_int (ctx, opt->name,
461           g_value_get_uint64 (value), AV_OPT_SEARCH_CHILDREN);
462       break;
463     case G_TYPE_DOUBLE:
464       res = av_opt_set_double (ctx, opt->name,
465           g_value_get_double (value), AV_OPT_SEARCH_CHILDREN);
466       break;
467     case G_TYPE_FLOAT:
468       res = av_opt_set_double (ctx, opt->name,
469           g_value_get_float (value), AV_OPT_SEARCH_CHILDREN);
470       break;
471     case G_TYPE_STRING:
472       res = av_opt_set (ctx, opt->name,
473           g_value_get_string (value), AV_OPT_SEARCH_CHILDREN);
474       /* Some code in FFmpeg returns ENOMEM if the string is NULL:
475        * *dst = av_strdup(val);
476        * return *dst ? 0 : AVERROR(ENOMEM);
477        * That makes little sense, let's ignore that
478        */
479       if (!g_value_get_string (value))
480         res = 0;
481       break;
482     case G_TYPE_BOOLEAN:
483       res = av_opt_set_int (ctx, opt->name,
484           g_value_get_boolean (value), AV_OPT_SEARCH_CHILDREN);
485       break;
486     default:
487       if (G_IS_PARAM_SPEC_ENUM (pspec)) {
488         res = av_opt_set_int (ctx, opt->name,
489             g_value_get_enum (value), AV_OPT_SEARCH_CHILDREN);
490       } else if (G_IS_PARAM_SPEC_FLAGS (pspec)) {
491         res = av_opt_set_int (ctx, opt->name,
492             g_value_get_flags (value), AV_OPT_SEARCH_CHILDREN);
493       } else {                  /* oops, bit lazy we don't cover this case yet */
494         g_critical ("%s does not yet support type %s", GST_FUNCTION,
495             g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
496       }
497   }
498
499   return res;
500 }
501
502 gboolean
503 gst_ffmpeg_cfg_set_property (AVCodecContext * refcontext, const GValue * value,
504     GParamSpec * pspec)
505 {
506   const AVOption *opt;
507
508   opt = g_param_spec_get_qdata (pspec, avoption_quark);
509
510   if (!opt)
511     return FALSE;
512
513   return set_option_value (refcontext, pspec, value, opt) >= 0;
514 }
515
516 gboolean
517 gst_ffmpeg_cfg_get_property (AVCodecContext * refcontext, GValue * value,
518     GParamSpec * pspec)
519 {
520   const AVOption *opt;
521   int res = -1;
522
523   opt = g_param_spec_get_qdata (pspec, avoption_quark);
524
525   if (!opt)
526     return FALSE;
527
528   switch (G_PARAM_SPEC_VALUE_TYPE (pspec)) {
529     case G_TYPE_INT:
530     {
531       int64_t val;
532       if ((res = av_opt_get_int (refcontext, opt->name,
533                   AV_OPT_SEARCH_CHILDREN, &val) >= 0))
534         g_value_set_int (value, val);
535       break;
536     }
537     case G_TYPE_INT64:
538     {
539       int64_t val;
540       if ((res = av_opt_get_int (refcontext, opt->name,
541                   AV_OPT_SEARCH_CHILDREN, &val) >= 0))
542         g_value_set_int64 (value, val);
543       break;
544     }
545     case G_TYPE_UINT64:
546     {
547       int64_t val;
548       if ((res = av_opt_get_int (refcontext, opt->name,
549                   AV_OPT_SEARCH_CHILDREN, &val) >= 0))
550         g_value_set_uint64 (value, val);
551       break;
552     }
553     case G_TYPE_DOUBLE:
554     {
555       gdouble val;
556       if ((res = av_opt_get_double (refcontext, opt->name,
557                   AV_OPT_SEARCH_CHILDREN, &val) >= 0))
558         g_value_set_double (value, val);
559       break;
560     }
561     case G_TYPE_FLOAT:
562     {
563       gdouble val;
564       if ((res = av_opt_get_double (refcontext, opt->name,
565                   AV_OPT_SEARCH_CHILDREN, &val) >= 0))
566         g_value_set_float (value, (gfloat) val);
567       break;
568     }
569     case G_TYPE_STRING:
570     {
571       uint8_t *val;
572       if ((res = av_opt_get (refcontext, opt->name,
573                   AV_OPT_SEARCH_CHILDREN | AV_OPT_ALLOW_NULL, &val) >= 0)) {
574         g_value_set_string (value, (gchar *) val);
575       }
576       break;
577     }
578     case G_TYPE_BOOLEAN:
579     {
580       int64_t val;
581       if ((res = av_opt_get_int (refcontext, opt->name,
582                   AV_OPT_SEARCH_CHILDREN, &val) >= 0))
583         g_value_set_boolean (value, val ? TRUE : FALSE);
584       break;
585     }
586     default:
587       if (G_IS_PARAM_SPEC_ENUM (pspec)) {
588         int64_t val;
589
590         if ((res = av_opt_get_int (refcontext, opt->name,
591                     AV_OPT_SEARCH_CHILDREN, &val) >= 0))
592           g_value_set_enum (value, val);
593       } else if (G_IS_PARAM_SPEC_FLAGS (pspec)) {
594         int64_t val;
595
596         if ((res = av_opt_get_int (refcontext, opt->name,
597                     AV_OPT_SEARCH_CHILDREN, &val) >= 0))
598           g_value_set_flags (value, val);
599       } else {                  /* oops, bit lazy we don't cover this case yet */
600         g_critical ("%s does not yet support type %s", GST_FUNCTION,
601             g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
602       }
603   }
604
605   return res >= 0;
606 }
607
608 void
609 gst_ffmpeg_cfg_fill_context (GObject * object, AVCodecContext * context)
610 {
611   GParamSpec **pspecs;
612   guint num_props, i;
613
614   pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (object),
615       &num_props);
616
617   for (i = 0; i < num_props; ++i) {
618     GParamSpec *pspec = pspecs[i];
619     const AVOption *opt;
620     GValue value = G_VALUE_INIT;
621
622     opt = g_param_spec_get_qdata (pspec, avoption_quark);
623
624     if (!opt)
625       continue;
626
627     g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
628     g_object_get_property (object, pspec->name, &value);
629     set_option_value (context, pspec, &value, opt);
630     g_value_unset (&value);
631   }
632   g_free (pspecs);
633 }
634
635 void
636 gst_ffmpeg_cfg_finalize (void)
637 {
638   GST_ERROR ("Finalizing");
639   g_assert (generic_overrides);
640   g_hash_table_unref (generic_overrides);
641 }