Advertisement
oanastratulat

Untitled

Jan 11th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.69 KB | None | 0 0
  1. diff --git a/libavcodec/vorbis.c b/libavcodec/vorbis.c
  2. index 28176f3..995d468 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,6 +206,7 @@ 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. @@ -220,7 +223,8 @@ void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
  30.              int x1 = list[pos].x;
  31.              int y1 = y_list[pos] * multiplier;
  32.              if (lx < samples)
  33. -                render_line(lx, ly, FFMIN(x1,samples), y1, out);
  34. +                if (render_line(lx, ly, FFMIN(x1,samples), y1, out) == -1)
  35. +                    return ;
  36.              lx = x1;
  37.              ly = y1;
  38.          }
  39. @@ -228,5 +232,6 @@ void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
  40.              break;
  41.      }
  42.      if (lx < samples)
  43. -        render_line(lx, ly, samples, ly, out);
  44. +        if (render_line(lx, ly, samples, ly, out) == -1)
  45. +            return;
  46.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement