oanastratulat

Untitled

Jan 11th, 2012
31
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/libavcodec/vorbis.c b/libavcodec/vorbis.c
  2. index 28176f3..77a711a 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,11 +206,12 @@ 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. -                                  uint16_t *y_list, int *flag,
  30. -                                  int multiplier, float *out, int samples)
  31. +int ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
  32. +                                 uint16_t *y_list, int *flag,
  33. +                                 int multiplier, float *out, int samples)
  34.  {
  35.      int lx, i;
  36.      uint8_t ly;
  37. @@ -219,14 +222,15 @@ void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
  38.          if (flag[pos]) {
  39.              int x1 = list[pos].x;
  40.              int y1 = y_list[pos] * multiplier;
  41. -            if (lx < samples)
  42. -                render_line(lx, ly, FFMIN(x1,samples), y1, out);
  43. +            if (lx < samples && render_line(lx, ly, FFMIN(x1,samples), y1, out) < 0)
  44. +                return -1;
  45.              lx = x1;
  46.              ly = y1;
  47.          }
  48.          if (lx >= samples)
  49.              break;
  50.      }
  51. -    if (lx < samples)
  52. -        render_line(lx, ly, samples, ly, out);
  53. +    if (lx < samples && render_line(lx, ly, samples, ly, out) <0)
  54. +               return -1;
  55. +    return 0;
  56.  }
  57. diff --git a/libavcodec/vorbis.h b/libavcodec/vorbis.h
  58. index cad080e..c69f255 100644
  59. --- a/libavcodec/vorbis.h
  60. +++ b/libavcodec/vorbis.h
  61. @@ -39,9 +39,9 @@ typedef struct {
  62.  void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values);
  63.  unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n); // x^(1/n)
  64.  int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num);
  65. -void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
  66. -                                  uint16_t *y_list, int *flag,
  67. -                                  int multiplier, float * out, int samples);
  68. +int ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
  69. +                                 uint16_t *y_list, int *flag,
  70. +                                 int multiplier, float * out, int samples);
  71.  void vorbis_inverse_coupling(float *mag, float *ang, int blocksize);
  72.  
  73.  #define ilog(i) av_log2(2*(i))
  74. diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
  75. index 6bf785e..b769eef 100644
  76. --- a/libavcodec/vorbisdec.c
  77. +++ b/libavcodec/vorbisdec.c
  78. @@ -1270,8 +1270,9 @@ static int vorbis_floor1_decode(vorbis_context *vc,
  79.  
  80.  // Curve synth - connect the calculated dots and convert from dB scale FIXME optimize ?
  81.  
  82. -    ff_vorbis_floor1_render_list(vf->list, vf->x_list_dim, floor1_Y_final, floor1_flag, vf->multiplier, vec, vf->list[1].x);
  83. -
  84. +    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)
  85. +        return AVERROR_INVALIDDATA;
  86. +        
  87.      av_dlog(NULL, " Floor decoded\n");
  88.  
  89.      return 0;
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×