Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/libavcodec/vorbis.c b/libavcodec/vorbis.c
- index 28176f3..77a711a 100644
- --- a/libavcodec/vorbis.c
- +++ b/libavcodec/vorbis.c
- @@ -179,12 +179,14 @@ static inline void render_line_unrolled(intptr_t x, uint8_t y, int x1,
- }
- }
- -static void render_line(int x0, uint8_t y0, int x1, int y1, float *buf)
- +static int render_line(int x0, uint8_t y0, int x1, int y1, float *buf)
- {
- int dy = y1 - y0;
- int adx = x1 - x0;
- int ady = FFABS(dy);
- int sy = dy < 0 ? -1 : 1;
- + if (adx == 0)
- + return -1;
- buf[x0] = ff_vorbis_floor1_inverse_db_table[y0];
- if (ady*2 <= adx) { // optimized common case
- render_line_unrolled(x0, y0, x1, sy, ady, adx, buf);
- @@ -204,11 +206,12 @@ static void render_line(int x0, uint8_t y0, int x1, int y1, float *buf)
- buf[x] = ff_vorbis_floor1_inverse_db_table[y];
- }
- }
- + return 0;
- }
- -void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
- - uint16_t *y_list, int *flag,
- - int multiplier, float *out, int samples)
- +int ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
- + uint16_t *y_list, int *flag,
- + int multiplier, float *out, int samples)
- {
- int lx, i;
- uint8_t ly;
- @@ -219,14 +222,15 @@ void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
- if (flag[pos]) {
- int x1 = list[pos].x;
- int y1 = y_list[pos] * multiplier;
- - if (lx < samples)
- - render_line(lx, ly, FFMIN(x1,samples), y1, out);
- + if (lx < samples && render_line(lx, ly, FFMIN(x1,samples), y1, out) < 0)
- + return -1;
- lx = x1;
- ly = y1;
- }
- if (lx >= samples)
- break;
- }
- - if (lx < samples)
- - render_line(lx, ly, samples, ly, out);
- + if (lx < samples && render_line(lx, ly, samples, ly, out) <0)
- + return -1;
- + return 0;
- }
- diff --git a/libavcodec/vorbis.h b/libavcodec/vorbis.h
- index cad080e..c69f255 100644
- --- a/libavcodec/vorbis.h
- +++ b/libavcodec/vorbis.h
- @@ -39,9 +39,9 @@ typedef struct {
- void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values);
- unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n); // x^(1/n)
- int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num);
- -void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
- - uint16_t *y_list, int *flag,
- - int multiplier, float * out, int samples);
- +int ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
- + uint16_t *y_list, int *flag,
- + int multiplier, float * out, int samples);
- void vorbis_inverse_coupling(float *mag, float *ang, int blocksize);
- #define ilog(i) av_log2(2*(i))
- diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
- index 6bf785e..b769eef 100644
- --- a/libavcodec/vorbisdec.c
- +++ b/libavcodec/vorbisdec.c
- @@ -1270,8 +1270,9 @@ static int vorbis_floor1_decode(vorbis_context *vc,
- // Curve synth - connect the calculated dots and convert from dB scale FIXME optimize ?
- - ff_vorbis_floor1_render_list(vf->list, vf->x_list_dim, floor1_Y_final, floor1_flag, vf->multiplier, vec, vf->list[1].x);
- -
- + if (ff_vorbis_floor1_render_list(vf->list, vf->x_list_dim, floor1_Y_final, floor1_flag, vf->multiplier, vec, vf->list[1].x) <0)
- + return AVERROR_INVALIDDATA;
- +
- av_dlog(NULL, " Floor decoded\n");
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement