Browse code

adxenc: use BLOCK_SIZE and BLOCK_SAMPLES macros

Justin Ruggles authored on 2011/12/20 00:23:21
Showing 1 changed files
... ...
@@ -42,7 +42,7 @@ static void adx_encode(ADXContext *c, uint8_t *adx, const int16_t *wav,
42 42
     int s0, s1, s2, d;
43 43
     int max = 0;
44 44
     int min = 0;
45
-    int data[32];
45
+    int data[BLOCK_SAMPLES];
46 46
 
47 47
     s1 = prev->s1;
48 48
     s2 = prev->s2;
... ...
@@ -61,7 +61,7 @@ static void adx_encode(ADXContext *c, uint8_t *adx, const int16_t *wav,
61 61
     prev->s2 = s2;
62 62
 
63 63
     if (max == 0 && min == 0) {
64
-        memset(adx, 0, 18);
64
+        memset(adx, 0, BLOCK_SIZE);
65 65
         return;
66 66
     }
67 67
 
... ...
@@ -76,7 +76,7 @@ static void adx_encode(ADXContext *c, uint8_t *adx, const int16_t *wav,
76 76
     AV_WB16(adx, scale);
77 77
 
78 78
     init_put_bits(&pb, adx + 2, 16);
79
-    for (i = 0; i < 32; i++)
79
+    for (i = 0; i < BLOCK_SAMPLES; i++)
80 80
         put_sbits(&pb, 4, av_clip(data[i] / scale, -8, 7));
81 81
     flush_put_bits(&pb);
82 82
 }
... ...
@@ -105,7 +105,7 @@ static av_cold int adx_encode_init(AVCodecContext *avctx)
105 105
         av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
106 106
         return AVERROR(EINVAL);
107 107
     }
108
-    avctx->frame_size = 32;
108
+    avctx->frame_size = BLOCK_SAMPLES;
109 109
 
110 110
     avctx->coded_frame = avcodec_alloc_frame();
111 111
 
... ...
@@ -138,7 +138,7 @@ static int adx_encode_frame(AVCodecContext *avctx, uint8_t *frame,
138 138
 
139 139
     for (ch = 0; ch < avctx->channels; ch++) {
140 140
         adx_encode(c, dst, samples + ch, &c->prev[ch], avctx->channels);
141
-        dst += 18;
141
+        dst += BLOCK_SIZE;
142 142
     }
143 143
     return dst - frame;
144 144
 }