Advertisement
oanastratulat

Untitled

Jan 11th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.01 KB | None | 0 0
  1. diff --git a/libavcodec/vorbis.c b/libavcodec/vorbis.c
  2. index 28176f3..97d9574 100644
  3. --- a/libavcodec/vorbis.c
  4. +++ b/libavcodec/vorbis.c
  5. @@ -179,12 +179,14 @@ static inline void render_line_unrolled(intptr_t x, uint8_t y, int x1,
  6.      }
  7.  }
  8.  
  9. -static void render_line(int x0, uint8_t y0, int x1, int y1, float *buf)
  10. +static int render_line(int x0, uint8_t y0, int x1, int y1, float *buf)
  11.  {
  12.      int dy  = y1 - y0;
  13.      int adx = x1 - x0;
  14.      int ady = FFABS(dy);
  15.      int sy  = dy < 0 ? -1 : 1;
  16. +    if (adx == 0)
  17. +        return -1;
  18.      buf[x0] = ff_vorbis_floor1_inverse_db_table[y0];
  19.      if (ady*2 <= adx) { // optimized common case
  20.          render_line_unrolled(x0, y0, x1, sy, ady, adx, buf);
  21. @@ -204,9 +206,10 @@ static void render_line(int x0, uint8_t y0, int x1, int y1, float *buf)
  22.              buf[x] = ff_vorbis_floor1_inverse_db_table[y];
  23.          }
  24.      }
  25. +       return 0;
  26.  }
  27.  
  28. -void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
  29. +int ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
  30.                                    uint16_t *y_list, int *flag,
  31.                                    int multiplier, float *out, int samples)
  32.  {
  33. @@ -220,7 +223,8 @@ void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
  34.              int x1 = list[pos].x;
  35.              int y1 = y_list[pos] * multiplier;
  36.              if (lx < samples)
  37. -                render_line(lx, ly, FFMIN(x1,samples), y1, out);
  38. +                if (render_line(lx, ly, FFMIN(x1,samples), y1, out) == -1)
  39. +                    return -1;
  40.              lx = x1;
  41.              ly = y1;
  42.          }
  43. @@ -228,5 +232,7 @@ void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
  44.              break;
  45.      }
  46.      if (lx < samples)
  47. -        render_line(lx, ly, samples, ly, out);
  48. +        if (render_line(lx, ly, samples, ly, out) == -1)
  49. +            return -1;
  50. +    return 0;
  51.  }
  52. diff --git a/libavcodec/vorbis.h b/libavcodec/vorbis.h
  53. index cad080e..03b1f1b 100644
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement