[FFmpeg-devel] [PATCH 3/3] Use LOCAL_ALIGNED macro for local arrays
Mans Rullgard
mans
Tue Feb 16 21:01:37 CET 2010
---
libavcodec/dnxhdenc.c | 4 ++--
libavcodec/dsputil.c | 14 +++++++-------
libavcodec/dv.c | 12 ++++++------
libavcodec/h264_loopfilter.c | 2 +-
libavcodec/ituh263dec.c | 2 +-
libavcodec/mpegvideo_enc.c | 2 +-
libavcodec/vp3.c | 2 +-
7 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index dbe9e08..5c98645 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -398,6 +398,7 @@ static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg, int jobnr, i
DNXHDEncContext *ctx = avctx->priv_data;
int mb_y = jobnr, mb_x;
int qscale = ctx->qscale;
+ LOCAL_ALIGNED_16(DCTELEM, block, [64]);
ctx = ctx->thread[threadnr];
ctx->m.last_dc[0] =
@@ -414,12 +415,11 @@ static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg, int jobnr, i
dnxhd_get_blocks(ctx, mb_x, mb_y);
for (i = 0; i < 8; i++) {
- DECLARE_ALIGNED_16(DCTELEM, block)[64];
DCTELEM *src_block = ctx->blocks[i];
int overflow, nbits, diff, last_index;
int n = dnxhd_switch_matrix(ctx, i);
- memcpy(block, src_block, sizeof(block));
+ memcpy(block, src_block, 64*sizeof(*block));
last_index = ctx->m.dct_quantize((MpegEncContext*)ctx, block, i, qscale, &overflow);
ac_bits += dnxhd_calc_ac_bits(ctx, block, last_index);
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 1f038fd..6032b5f 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -3788,7 +3788,7 @@ static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_
static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
MpegEncContext * const s= (MpegEncContext *)c;
- DECLARE_ALIGNED_16(DCTELEM, temp)[64];
+ LOCAL_ALIGNED_16(DCTELEM, temp, [64]);
assert(h==8);
@@ -3852,7 +3852,7 @@ static int dct264_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *s
static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
MpegEncContext * const s= (MpegEncContext *)c;
- DECLARE_ALIGNED_16(DCTELEM, temp)[64];
+ LOCAL_ALIGNED_16(DCTELEM, temp, [64]);
int sum=0, i;
assert(h==8);
@@ -3868,7 +3868,7 @@ static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2
static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
MpegEncContext * const s= (MpegEncContext *)c;
- DECLARE_ALIGNED_16(DCTELEM, temp)[64*2];
+ LOCAL_ALIGNED_16(DCTELEM, temp, [64*2]);
DCTELEM * const bak = temp+64;
int sum=0, i;
@@ -3892,9 +3892,9 @@ static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *s
static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
MpegEncContext * const s= (MpegEncContext *)c;
const uint8_t *scantable= s->intra_scantable.permutated;
- DECLARE_ALIGNED_16(DCTELEM, temp)[64];
- DECLARE_ALIGNED_16(uint8_t, lsrc1)[64];
- DECLARE_ALIGNED_16(uint8_t, lsrc2)[64];
+ LOCAL_ALIGNED_16(DCTELEM, temp, [64]);
+ LOCAL_ALIGNED_16(uint8_t, lsrc1, [64]);
+ LOCAL_ALIGNED_16(uint8_t, lsrc2, [64]);
int i, last, run, bits, level, distortion, start_i;
const int esc_length= s->ac_esc_length;
uint8_t * length;
@@ -3968,7 +3968,7 @@ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int
static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
MpegEncContext * const s= (MpegEncContext *)c;
const uint8_t *scantable= s->intra_scantable.permutated;
- DECLARE_ALIGNED_16(DCTELEM, temp)[64];
+ LOCAL_ALIGNED_16(DCTELEM, temp, [64]);
int i, last, run, bits, level, start_i;
const int esc_length= s->ac_esc_length;
uint8_t * length;
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 94833fc..093ba9d 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -532,16 +532,16 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
PutBitContext pb, vs_pb;
GetBitContext gb;
BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1;
- DECLARE_ALIGNED_16(DCTELEM, sblock)[5*DV_MAX_BPM][64];
- DECLARE_ALIGNED_16(uint8_t, mb_bit_buffer)[80 + 4]; /* allow some slack */
- DECLARE_ALIGNED_16(uint8_t, vs_bit_buffer)[5 * 80 + 4]; /* allow some slack */
+ LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]);
+ LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [80 + 4]); /* allow some slack */
+ LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5 * 80 + 4]); /* allow some slack */
const int log2_blocksize = 3-s->avctx->lowres;
int is_field_mode[5];
assert((((int)mb_bit_buffer) & 7) == 0);
assert((((int)vs_bit_buffer) & 7) == 0);
- memset(sblock, 0, sizeof(sblock));
+ memset(sblock, 0, 5*DV_MAX_BPM*sizeof(*sblock));
/* pass 1 : read DC and AC coefficients in blocks */
buf_ptr = &s->buf[work_chunk->buf_offset*80];
@@ -833,7 +833,7 @@ static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i
{
const int *weight;
const uint8_t* zigzag_scan;
- DECLARE_ALIGNED_16(DCTELEM, blk)[64];
+ LOCAL_ALIGNED_16(DCTELEM, blk, [64]);
int i, area;
/* We offer two different methods for class number assignment: the
method suggested in SMPTE 314M Table 22, and an improved
@@ -866,7 +866,7 @@ static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i
} else {
/* We rely on the fact that encoding all zeros leads to an immediate EOB,
which is precisely what the spec calls for in the "dummy" blocks. */
- memset(blk, 0, sizeof(blk));
+ memset(blk, 0, 64*sizeof(*blk));
bi->dct_mode = 0;
}
bi->mb[0] = blk[0];
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index cef256a..1e2b044 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -367,7 +367,7 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
return;
} else {
- DECLARE_ALIGNED_8(int16_t, bS)[2][4][4];
+ LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]);
uint64_t (*bSv)[4] = (uint64_t(*)[4])bS;
int edges;
if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 ) {
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index aab00d1..75106be 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -563,7 +563,7 @@ not_coded:
static int h263_skip_b_part(MpegEncContext *s, int cbp)
{
- DECLARE_ALIGNED(16, DCTELEM, dblock)[64];
+ LOCAL_ALIGNED_16(DCTELEM, dblock, [64]);
int i, mbi;
/* we have to set s->mb_intra to zero to decode B-part of PB-frame correctly
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index aaf0cad..127b992 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3311,7 +3311,7 @@ static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise?
DCTELEM *block, int16_t *weight, DCTELEM *orig,
int n, int qscale){
int16_t rem[64];
- DECLARE_ALIGNED_16(DCTELEM, d1)[64];
+ LOCAL_ALIGNED_16(DCTELEM, d1, [64]);
const uint8_t *scantable= s->intra_scantable.scantable;
const uint8_t *perm_scantable= s->intra_scantable.permutated;
// unsigned int threshold1, threshold2;
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 0f3d7eb..59698d2 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -1385,7 +1385,7 @@ static void render_slice(Vp3DecodeContext *s, int slice)
{
int x;
int16_t *dequantizer;
- DECLARE_ALIGNED_16(DCTELEM, block)[64];
+ LOCAL_ALIGNED_16(DCTELEM, block, [64]);
int motion_x = 0xdeadbeef, motion_y = 0xdeadbeef;
int motion_halfpel_index;
uint8_t *motion_source;
--
1.7.0
More information about the ffmpeg-devel
mailing list