[FFmpeg-devel] [PATCH WIP v2 1/9] avfilter/dnn: Refactor DNN parameter configuration system
Zhao Zhili
quinkblack at foxmail.com
Tue Apr 30 10:13:40 EEST 2024
> On Apr 30, 2024, at 13:54, Chen, Wenbin <wenbin.chen-at-intel.com at ffmpeg.org> wrote:
>
>> -----Original Message-----
>> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of Zhao
>> Zhili
>> Sent: Sunday, April 28, 2024 2:47 PM
>> To: ffmpeg-devel at ffmpeg.org
>> Cc: Zhao Zhili <zhilizhao at tencent.com>
>> Subject: [FFmpeg-devel] [PATCH WIP v2 1/9] avfilter/dnn: Refactor DNN
>> parameter configuration system
>>
>> From: Zhao Zhili <zhilizhao at 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.
Sure, here comes v3: https://ffmpeg.org/pipermail/ffmpeg-devel/2024-April/326495.html
>
> 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 at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list