dnn/queue: remove prefix FF for Queue and SafeQueue

we don't need FF prefix for internal data struct

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
This commit is contained in:
Guo, Yejun 2021-01-18 16:09:56 +08:00
parent c5e30d588d
commit d4f40c1b60
5 changed files with 57 additions and 57 deletions

View File

@ -55,8 +55,8 @@ typedef struct OVModel{
ie_infer_request_t *infer_request;
/* for async execution */
FFSafeQueue *request_queue; // holds RequestItem
FFQueue *task_queue; // holds TaskItem
SafeQueue *request_queue; // holds RequestItem
Queue *task_queue; // holds TaskItem
} OVModel;
typedef struct TaskItem {

View File

@ -23,31 +23,31 @@
#include "libavutil/mem.h"
#include "libavutil/avassert.h"
typedef struct FFQueueEntry FFQueueEntry;
typedef struct QueueEntry QueueEntry;
struct FFQueueEntry {
struct QueueEntry {
void *value;
FFQueueEntry *prev;
FFQueueEntry *next;
QueueEntry *prev;
QueueEntry *next;
};
struct FFQueue {
FFQueueEntry *head;
FFQueueEntry *tail;
struct Queue {
QueueEntry *head;
QueueEntry *tail;
size_t length;
};
static inline FFQueueEntry *create_entry(void *val)
static inline QueueEntry *create_entry(void *val)
{
FFQueueEntry *entry = av_malloc(sizeof(*entry));
QueueEntry *entry = av_malloc(sizeof(*entry));
if (entry)
entry->value = val;
return entry;
}
FFQueue* ff_queue_create(void)
Queue* ff_queue_create(void)
{
FFQueue *q = av_malloc(sizeof(*q));
Queue *q = av_malloc(sizeof(*q));
if (!q)
return NULL;
@ -70,15 +70,15 @@ FFQueue* ff_queue_create(void)
return q;
}
void ff_queue_destroy(FFQueue *q)
void ff_queue_destroy(Queue *q)
{
FFQueueEntry *entry;
QueueEntry *entry;
if (!q)
return;
entry = q->head;
while (entry != NULL) {
FFQueueEntry *temp = entry;
QueueEntry *temp = entry;
entry = entry->next;
av_freep(&temp);
}
@ -86,12 +86,12 @@ void ff_queue_destroy(FFQueue *q)
av_freep(&q);
}
size_t ff_queue_size(FFQueue *q)
size_t ff_queue_size(Queue *q)
{
return q ? q->length : 0;
}
void *ff_queue_peek_front(FFQueue *q)
void *ff_queue_peek_front(Queue *q)
{
if (!q || q->length == 0)
return NULL;
@ -99,7 +99,7 @@ void *ff_queue_peek_front(FFQueue *q)
return q->head->next->value;
}
void *ff_queue_peek_back(FFQueue *q)
void *ff_queue_peek_back(Queue *q)
{
if (!q || q->length == 0)
return NULL;
@ -107,10 +107,10 @@ void *ff_queue_peek_back(FFQueue *q)
return q->tail->prev->value;
}
int ff_queue_push_front(FFQueue *q, void *v)
int ff_queue_push_front(Queue *q, void *v)
{
FFQueueEntry *new_entry;
FFQueueEntry *original_next;
QueueEntry *new_entry;
QueueEntry *original_next;
if (!q)
return 0;
@ -128,10 +128,10 @@ int ff_queue_push_front(FFQueue *q, void *v)
return q->length;
}
int ff_queue_push_back(FFQueue *q, void *v)
int ff_queue_push_back(Queue *q, void *v)
{
FFQueueEntry *new_entry;
FFQueueEntry *original_prev;
QueueEntry *new_entry;
QueueEntry *original_prev;
if (!q)
return 0;
@ -149,10 +149,10 @@ int ff_queue_push_back(FFQueue *q, void *v)
return q->length;
}
void *ff_queue_pop_front(FFQueue *q)
void *ff_queue_pop_front(Queue *q)
{
FFQueueEntry *front;
FFQueueEntry *new_head_next;
QueueEntry *front;
QueueEntry *new_head_next;
void *ret;
if (!q || q->length == 0)
@ -170,10 +170,10 @@ void *ff_queue_pop_front(FFQueue *q)
return ret;
}
void *ff_queue_pop_back(FFQueue *q)
void *ff_queue_pop_back(Queue *q)
{
FFQueueEntry *back;
FFQueueEntry *new_tail_prev;
QueueEntry *back;
QueueEntry *new_tail_prev;
void *ret;
if (!q || q->length == 0)

View File

@ -22,20 +22,20 @@
#ifndef AVFILTER_DNN_QUEUE_H
#define AVFILTER_DNN_QUEUE_H
typedef struct FFQueue FFQueue;
typedef struct Queue Queue;
FFQueue *ff_queue_create(void);
void ff_queue_destroy(FFQueue *q);
Queue *ff_queue_create(void);
void ff_queue_destroy(Queue *q);
size_t ff_queue_size(FFQueue *q);
size_t ff_queue_size(Queue *q);
void *ff_queue_peek_front(FFQueue *q);
void *ff_queue_peek_back(FFQueue *q);
void *ff_queue_peek_front(Queue *q);
void *ff_queue_peek_back(Queue *q);
int ff_queue_push_front(FFQueue *q, void *v);
int ff_queue_push_back(FFQueue *q, void *v);
int ff_queue_push_front(Queue *q, void *v);
int ff_queue_push_back(Queue *q, void *v);
void *ff_queue_pop_front(FFQueue *q);
void *ff_queue_pop_back(FFQueue *q);
void *ff_queue_pop_front(Queue *q);
void *ff_queue_pop_back(Queue *q);
#endif

View File

@ -43,15 +43,15 @@ static inline int dnn_cond_wait(DNNCond *cond, AVMutex *mutex)
}
#endif
struct FFSafeQueue {
FFQueue *q;
struct SafeQueue {
Queue *q;
AVMutex mutex;
DNNCond cond;
};
FFSafeQueue *ff_safe_queue_create(void)
SafeQueue *ff_safe_queue_create(void)
{
FFSafeQueue *sq = av_malloc(sizeof(*sq));
SafeQueue *sq = av_malloc(sizeof(*sq));
if (!sq)
return NULL;
@ -66,7 +66,7 @@ FFSafeQueue *ff_safe_queue_create(void)
return sq;
}
void ff_safe_queue_destroy(FFSafeQueue *sq)
void ff_safe_queue_destroy(SafeQueue *sq)
{
if (!sq)
return;
@ -77,12 +77,12 @@ void ff_safe_queue_destroy(FFSafeQueue *sq)
av_freep(&sq);
}
size_t ff_safe_queue_size(FFSafeQueue *sq)
size_t ff_safe_queue_size(SafeQueue *sq)
{
return sq ? ff_queue_size(sq->q) : 0;
}
int ff_safe_queue_push_front(FFSafeQueue *sq, void *v)
int ff_safe_queue_push_front(SafeQueue *sq, void *v)
{
int ret;
ff_mutex_lock(&sq->mutex);
@ -92,7 +92,7 @@ int ff_safe_queue_push_front(FFSafeQueue *sq, void *v)
return ret;
}
int ff_safe_queue_push_back(FFSafeQueue *sq, void *v)
int ff_safe_queue_push_back(SafeQueue *sq, void *v)
{
int ret;
ff_mutex_lock(&sq->mutex);
@ -102,7 +102,7 @@ int ff_safe_queue_push_back(FFSafeQueue *sq, void *v)
return ret;
}
void *ff_safe_queue_pop_front(FFSafeQueue *sq)
void *ff_safe_queue_pop_front(SafeQueue *sq)
{
void *value;
ff_mutex_lock(&sq->mutex);

View File

@ -21,16 +21,16 @@
#ifndef AVFILTER_DNN_SAFE_QUEUE_H
#define AVFILTER_DNN_SAFE_QUEUE_H
typedef struct FFSafeQueue FFSafeQueue;
typedef struct SafeQueue SafeQueue;
FFSafeQueue *ff_safe_queue_create(void);
void ff_safe_queue_destroy(FFSafeQueue *sq);
SafeQueue *ff_safe_queue_create(void);
void ff_safe_queue_destroy(SafeQueue *sq);
size_t ff_safe_queue_size(FFSafeQueue *sq);
size_t ff_safe_queue_size(SafeQueue *sq);
int ff_safe_queue_push_front(FFSafeQueue *sq, void *v);
int ff_safe_queue_push_back(FFSafeQueue *sq, void *v);
int ff_safe_queue_push_front(SafeQueue *sq, void *v);
int ff_safe_queue_push_back(SafeQueue *sq, void *v);
void *ff_safe_queue_pop_front(FFSafeQueue *sq);
void *ff_safe_queue_pop_front(SafeQueue *sq);
#endif