> -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-boun...@ffmpeg.org> On Behalf Of Zhao > Zhili > Sent: Sunday, April 28, 2024 2:47 PM > To: ffmpeg-devel@ffmpeg.org > Cc: Zhao Zhili <zhiliz...@tencent.com> > Subject: [FFmpeg-devel] [PATCH WIP v2 1/9] avfilter/dnn: Refactor DNN > parameter configuration system > > From: Zhao Zhili <zhiliz...@tencent.com> > + > +void *ff_dnn_child_next(DnnContext *obj, void *prev) { > + size_t pre_offset; > + char *ptr; > + > + if (!prev) { > + obj->clazz = &dnn_base_class; > + return obj; > + } > + > + pre_offset = (char *)prev - (char *)obj; > + for (int i = 0; i < FF_ARRAY_ELEMS(dnn_backend_info_list) - 1; i++) { > + if (dnn_backend_info_list[i].offset == pre_offset) { > + ptr = (char *)obj + dnn_backend_info_list[i + 1].offset; > + *(const AVClass **) ptr = dnn_backend_info_list[i + 1].class; > + return ptr; > + } > + } > + > + return NULL; > +}
Can this function be simplified by implementing AVFilter.preinit interface in each dnn filter and assign class to DNNContext and TF/OV/THOption in preinit function? I don't think setting AVClass in child_next() function is the proper way. wenbin > + > +const AVClass *ff_dnn_child_class_iterate(void **iter) > +{ > + uintptr_t i = (uintptr_t) *iter; > + > + if (i < FF_ARRAY_ELEMS(dnn_backend_info_list)) { > + *iter = (void *)(i + 1); > + return dnn_backend_info_list[i].class; > + } > + > + return NULL; > +} _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".