diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-25 23:19:42 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-28 23:37:12 +0200 |
commit | 4393331250d1f61be0d159de2a7976087a118c25 (patch) | |
tree | 241e43832c39d39227c533e3a41fc790fb5027c2 /libavcodec/dirac_dwt_template.c | |
parent | a91ddce6894af70ed7389eaf2a84f844e9f7b7e9 (diff) | |
download | ffmpeg-4393331250d1f61be0d159de2a7976087a118c25.tar.gz |
avcodec/dirac_dwt: Avoid conversions between function pointers and void*
Pointers to void can be converted to any pointer to incomplete or
object type and back; but they are nevertheless not completely generic
pointers: There is no provision in the C standard that guarantees their
convertibility with function pointers. C90 lacks a generic function
pointer, C99 made every function pointer a generic function pointer and
still disallows the convertibility with void *. Both GCC as well as
Clang warn about this when using -pedantic.
Therefore use unions to avoid these conversions.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/dirac_dwt_template.c')
-rw-r--r-- | libavcodec/dirac_dwt_template.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/libavcodec/dirac_dwt_template.c b/libavcodec/dirac_dwt_template.c index f1d7f8b22f..0d39754ed8 100644 --- a/libavcodec/dirac_dwt_template.c +++ b/libavcodec/dirac_dwt_template.c @@ -338,8 +338,8 @@ static void RENAME(vertical_compose_daub97iL1)(uint8_t *_b0, uint8_t *_b1, uint8 static void RENAME(spatial_compose_dd97i_dy)(DWTContext *d, int level, int width, int height, int stride) { - vertical_compose_3tap vertical_compose_l0 = (void*)d->vertical_compose_l0; - vertical_compose_5tap vertical_compose_h0 = (void*)d->vertical_compose_h0; + vertical_compose_3tap vertical_compose_l0 = d->vertical_compose_l0.tap3; + vertical_compose_5tap vertical_compose_h0 = d->vertical_compose_h0.tap5; DWTCompose *cs = d->cs + level; int i, y = cs->y; @@ -362,8 +362,8 @@ static void RENAME(spatial_compose_dd97i_dy)(DWTContext *d, int level, int width static void RENAME(spatial_compose_dirac53i_dy)(DWTContext *d, int level, int width, int height, int stride) { - vertical_compose_3tap vertical_compose_l0 = (void*)d->vertical_compose_l0; - vertical_compose_3tap vertical_compose_h0 = (void*)d->vertical_compose_h0; + vertical_compose_3tap vertical_compose_l0 = d->vertical_compose_l0.tap3; + vertical_compose_3tap vertical_compose_h0 = d->vertical_compose_h0.tap3; DWTCompose *cs = d->cs + level; int y= cs->y; @@ -384,8 +384,8 @@ static void RENAME(spatial_compose_dirac53i_dy)(DWTContext *d, int level, int wi static void RENAME(spatial_compose_dd137i_dy)(DWTContext *d, int level, int width, int height, int stride) { - vertical_compose_5tap vertical_compose_l0 = (void*)d->vertical_compose_l0; - vertical_compose_5tap vertical_compose_h0 = (void*)d->vertical_compose_h0; + vertical_compose_5tap vertical_compose_l0 = d->vertical_compose_l0.tap5; + vertical_compose_5tap vertical_compose_h0 = d->vertical_compose_h0.tap5; DWTCompose *cs = d->cs + level; int i, y = cs->y; @@ -409,7 +409,7 @@ static void RENAME(spatial_compose_dd137i_dy)(DWTContext *d, int level, int widt // haar makes the assumption that height is even (always true for dirac) static void RENAME(spatial_compose_haari_dy)(DWTContext *d, int level, int width, int height, int stride) { - vertical_compose_2tap vertical_compose = (void*)d->vertical_compose; + vertical_compose_2tap vertical_compose = d->vertical_compose; int y = d->cs[level].y; uint8_t *b0 = d->buffer + (y-1)*stride; uint8_t *b1 = d->buffer + (y )*stride; @@ -425,8 +425,8 @@ static void RENAME(spatial_compose_haari_dy)(DWTContext *d, int level, int width // Fortunately, this filter isn't used in practice. static void RENAME(spatial_compose_fidelity)(DWTContext *d, int level, int width, int height, int stride) { - vertical_compose_9tap vertical_compose_l0 = (void*)d->vertical_compose_l0; - vertical_compose_9tap vertical_compose_h0 = (void*)d->vertical_compose_h0; + vertical_compose_9tap vertical_compose_l0 = d->vertical_compose_l0.tap9; + vertical_compose_9tap vertical_compose_h0 = d->vertical_compose_h0.tap9; int i, y; uint8_t *b[8]; @@ -450,10 +450,10 @@ static void RENAME(spatial_compose_fidelity)(DWTContext *d, int level, int width static void RENAME(spatial_compose_daub97i_dy)(DWTContext *d, int level, int width, int height, int stride) { - vertical_compose_3tap vertical_compose_l0 = (void*)d->vertical_compose_l0; - vertical_compose_3tap vertical_compose_h0 = (void*)d->vertical_compose_h0; - vertical_compose_3tap vertical_compose_l1 = (void*)d->vertical_compose_l1; - vertical_compose_3tap vertical_compose_h1 = (void*)d->vertical_compose_h1; + vertical_compose_3tap vertical_compose_l0 = d->vertical_compose_l0.tap3; + vertical_compose_3tap vertical_compose_h0 = d->vertical_compose_h0.tap3; + vertical_compose_3tap vertical_compose_l1 = d->vertical_compose_l1; + vertical_compose_3tap vertical_compose_h1 = d->vertical_compose_h1; DWTCompose *cs = d->cs + level; int i, y = cs->y; @@ -552,29 +552,29 @@ static int RENAME(spatial_idwt_init)(DWTContext *d, enum dwt_type type) switch (type) { case DWT_DIRAC_DD9_7: d->spatial_compose = RENAME(spatial_compose_dd97i_dy); - d->vertical_compose_l0 = (void*)RENAME(vertical_compose53iL0); - d->vertical_compose_h0 = (void*)RENAME(vertical_compose_dd97iH0); + d->vertical_compose_l0.tap3 = RENAME(vertical_compose53iL0); + d->vertical_compose_h0.tap5 = RENAME(vertical_compose_dd97iH0); d->horizontal_compose = RENAME(horizontal_compose_dd97i); d->support = 7; break; case DWT_DIRAC_LEGALL5_3: d->spatial_compose = RENAME(spatial_compose_dirac53i_dy); - d->vertical_compose_l0 = (void*)RENAME(vertical_compose53iL0); - d->vertical_compose_h0 = (void*)RENAME(vertical_compose_dirac53iH0); + d->vertical_compose_l0.tap3 = RENAME(vertical_compose53iL0); + d->vertical_compose_h0.tap3 = RENAME(vertical_compose_dirac53iH0); d->horizontal_compose = RENAME(horizontal_compose_dirac53i); d->support = 3; break; case DWT_DIRAC_DD13_7: d->spatial_compose = RENAME(spatial_compose_dd137i_dy); - d->vertical_compose_l0 = (void*)RENAME(vertical_compose_dd137iL0); - d->vertical_compose_h0 = (void*)RENAME(vertical_compose_dd97iH0); + d->vertical_compose_l0.tap5 = RENAME(vertical_compose_dd137iL0); + d->vertical_compose_h0.tap5 = RENAME(vertical_compose_dd97iH0); d->horizontal_compose = RENAME(horizontal_compose_dd137i); d->support = 7; break; case DWT_DIRAC_HAAR0: case DWT_DIRAC_HAAR1: d->spatial_compose = RENAME(spatial_compose_haari_dy); - d->vertical_compose = (void*)RENAME(vertical_compose_haar); + d->vertical_compose = RENAME(vertical_compose_haar); if (type == DWT_DIRAC_HAAR0) d->horizontal_compose = RENAME(horizontal_compose_haar0i); else @@ -583,17 +583,17 @@ static int RENAME(spatial_idwt_init)(DWTContext *d, enum dwt_type type) break; case DWT_DIRAC_FIDELITY: d->spatial_compose = RENAME(spatial_compose_fidelity); - d->vertical_compose_l0 = (void*)RENAME(vertical_compose_fidelityiL0); - d->vertical_compose_h0 = (void*)RENAME(vertical_compose_fidelityiH0); + d->vertical_compose_l0.tap9 = RENAME(vertical_compose_fidelityiL0); + d->vertical_compose_h0.tap9 = RENAME(vertical_compose_fidelityiH0); d->horizontal_compose = RENAME(horizontal_compose_fidelityi); d->support = 0; // not really used break; case DWT_DIRAC_DAUB9_7: d->spatial_compose = RENAME(spatial_compose_daub97i_dy); - d->vertical_compose_l0 = (void*)RENAME(vertical_compose_daub97iL0); - d->vertical_compose_h0 = (void*)RENAME(vertical_compose_daub97iH0); - d->vertical_compose_l1 = (void*)RENAME(vertical_compose_daub97iL1); - d->vertical_compose_h1 = (void*)RENAME(vertical_compose_daub97iH1); + d->vertical_compose_l0.tap3 = RENAME(vertical_compose_daub97iL0); + d->vertical_compose_h0.tap3 = RENAME(vertical_compose_daub97iH0); + d->vertical_compose_l1 = RENAME(vertical_compose_daub97iL1); + d->vertical_compose_h1 = RENAME(vertical_compose_daub97iH1); d->horizontal_compose = RENAME(horizontal_compose_daub97i); d->support = 5; break; |