summaryrefslogtreecommitdiff
path: root/libavcodec/elbg.h
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2014-12-16 10:33:36 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2014-12-18 23:22:59 +0100
commitae2d41ec875965ce4ab9fdd88a5e8ba57cada67a (patch)
tree615470e0fe453c20df5b6e976950d9ee855809db /libavcodec/elbg.h
parent5d839778b9f3edb682b7f71dde4f80f07c75b098 (diff)
elbg: check memory allocations and propagate errors
Diffstat (limited to 'libavcodec/elbg.h')
-rw-r--r--libavcodec/elbg.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/libavcodec/elbg.h b/libavcodec/elbg.h
index b8ea489b24..3b1587a3ab 100644
--- a/libavcodec/elbg.h
+++ b/libavcodec/elbg.h
@@ -36,10 +36,11 @@
* @param num_steps The maximum number of steps. One step is already a good compromise between time and quality.
* @param closest_cb Return the closest codebook to each point. Must be allocated.
* @param rand_state A random number generator state. Should be already initialized by av_lfg_init().
+ * @return < 0 in case of error, 0 otherwise
*/
-void ff_do_elbg(int *points, int dim, int numpoints, int *codebook,
- int numCB, int num_steps, int *closest_cb,
- AVLFG *rand_state);
+int ff_do_elbg(int *points, int dim, int numpoints, int *codebook,
+ int numCB, int num_steps, int *closest_cb,
+ AVLFG *rand_state);
/**
* Initialize the **codebook vector for the elbg algorithm. If you have already
@@ -47,9 +48,10 @@ void ff_do_elbg(int *points, int dim, int numpoints, int *codebook,
* If numpoints < 8*numCB this function fills **codebook with random numbers.
* If not, it calls ff_do_elbg for a (smaller) random sample of the points in
* **points. Get the same parameters as ff_do_elbg.
+ * @return < 0 in case of error, 0 otherwise
*/
-void ff_init_elbg(int *points, int dim, int numpoints, int *codebook,
- int numCB, int num_steps, int *closest_cb,
- AVLFG *rand_state);
+int ff_init_elbg(int *points, int dim, int numpoints, int *codebook,
+ int numCB, int num_steps, int *closest_cb,
+ AVLFG *rand_state);
#endif /* AVCODEC_ELBG_H */