• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 Vitor Sessak <vitor1001@gmail.com>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVCODEC_ELBG_H
22 #define AVCODEC_ELBG_H
23 
24 #include <stdint.h>
25 #include "libavutil/lfg.h"
26 
27 struct ELBGContext;
28 
29 /**
30  * Implementation of the Enhanced LBG Algorithm
31  * Based on the paper "Neural Networks 14:1219-1237" that can be found in
32  * http://citeseer.ist.psu.edu/patan01enhanced.html .
33  *
34  * @param ctx  A pointer to a pointer to an already allocated ELBGContext
35  *             or a pointer to NULL. In the latter case, this function
36  *             will allocate an ELBGContext and put a pointer to it in `*ctx`.
37  * @param points Input points.
38  * @param dim Dimension of the points.
39  * @param numpoints Num of points in **points.
40  * @param codebook Pointer to the output codebook. Must be allocated.
41  * @param num_cb Number of points in the codebook.
42  * @param num_steps The maximum number of steps. One step is already a good compromise between time and quality.
43  * @param closest_cb Return the closest codebook to each point. Must be allocated.
44  * @param rand_state A random number generator state. Should be already initialized by av_lfg_init().
45  * @param flags Currently unused; must be set to 0.
46  * @return < 0 in case of error, 0 otherwise
47  */
48 int avpriv_elbg_do(struct ELBGContext **ctx, int *points, int dim,
49                    int numpoints, int *codebook, int num_cb, int num_steps,
50                    int *closest_cb, AVLFG *rand_state, uintptr_t flags);
51 
52 /**
53  * Free an ELBGContext and reset the pointer to it.
54  */
55 void avpriv_elbg_free(struct ELBGContext **ctx);
56 
57 #endif /* AVCODEC_ELBG_H */
58