These casts cast const away temporarily; they are safe, because the pointers that are initialized point to const data. But this is nevertheless not nice and leads to warnings when using -Wcast-qual. blend_modes.c generates 546 (2*39*7) such warnings which is the majority of such warnings for FFmpeg as a whole. vf_blend.c and vf_blend_init.h also use this pattern; they have also been changed.
Showing the changes to libavfilter (3 of 3 files). Show all
Unified · Split
| @@ -93,8 +93,8 @@ static void fn0(NAME)(const uint8_t *_top, ptrdiff_t top_linesize, \ · 92 unmodified lines | |||
| 93 | ptrdiff_t width, ptrdiff_t height, \ | 93 | ptrdiff_t width, ptrdiff_t height, \ |
| 94 | FilterParams *param, double *values, int starty) \ | 94 | FilterParams *param, double *values, int starty) \ |
| 95 | { \ | 95 | { \ |
| 96 | const PIXEL *top = (PIXEL *)_top; \ | 96 | const PIXEL *top = (const PIXEL *)_top; \ |
| 97 | const PIXEL *bottom = (PIXEL *)_bottom; \ | 97 | const PIXEL *bottom = (const PIXEL *)_bottom; \ |
| 98 | PIXEL *dst = (PIXEL *)_dst; \ | 98 | PIXEL *dst = (PIXEL *)_dst; \ |
| 99 | const float opacity = param->opacity; \ | 99 | const float opacity = param->opacity; \ |
| 100 | \ | 100 | \ |
| @@ -133,8 +133,8 @@ static void blend_expr_## name(const uint8_t *_top, ptrdiff_t top_linesize, · 132 unmodified lines | |||
| 133 | ptrdiff_t width, ptrdiff_t height, \ | 133 | ptrdiff_t width, ptrdiff_t height, \ |
| 134 | FilterParams *param, double *values, int starty) \ | 134 | FilterParams *param, double *values, int starty) \ |
| 135 | { \ | 135 | { \ |
| 136 | const type *top = (type*)_top; \ | 136 | const type *top = (const type*)_top; \ |
| 137 | const type *bottom = (type*)_bottom; \ | 137 | const type *bottom = (const type*)_bottom; \ |
| 138 | type *dst = (type*)_dst; \ | 138 | type *dst = (type*)_dst; \ |
| 139 | AVExpr *e = param->e; \ | 139 | AVExpr *e = param->e; \ |
| 140 | int y, x; \ | 140 | int y, x; \ |
| @@ -82,8 +82,8 @@ static void blend_normal_##name(const uint8_t *_top, ptrdiff_t top_linesize, · 81 unmodified lines | |||
| 82 | ptrdiff_t width, ptrdiff_t height, \ | 82 | ptrdiff_t width, ptrdiff_t height, \ |
| 83 | FilterParams *param, double *values, int starty) \ | 83 | FilterParams *param, double *values, int starty) \ |
| 84 | { \ | 84 | { \ |
| 85 | const type *top = (type*)_top; \ | 85 | const type *top = (const type*)_top; \ |
| 86 | const type *bottom = (type*)_bottom; \ | 86 | const type *bottom = (const type*)_bottom; \ |
| 87 | type *dst = (type*)_dst; \ | 87 | type *dst = (type*)_dst; \ |
| 88 | const float opacity = param->opacity; \ | 88 | const float opacity = param->opacity; \ |
| 89 | \ | 89 | \ |