Fixes use of uninitialized variables.
Showing the changes to libavfilter (2 of 2 files). Show all
Unified · Split
| @@ -110,6 +110,7 @@ typedef struct V360Context { · 109 unmodified lines | |||
| 110 | 110 | ||
| 111 | int planewidth[4], planeheight[4]; | 111 | int planewidth[4], planeheight[4]; |
| 112 | int inplanewidth[4], inplaneheight[4]; | 112 | int inplanewidth[4], inplaneheight[4]; |
| 113 | int uv_linesize[4]; | ||
| 113 | int nb_planes; | 114 | int nb_planes; |
| 114 | int nb_allocated; | 115 | int nb_allocated; |
| 115 | 116 | ||
| @@ -222,6 +222,7 @@ static int remap##ws##_##bits##bit_slice(AVFilterContext *ctx, void *arg, int jo · 221 unmodified lines | |||
| 222 | for (int plane = 0; plane < s->nb_planes; plane++) { \ | 222 | for (int plane = 0; plane < s->nb_planes; plane++) { \ |
| 223 | const int in_linesize = in->linesize[plane]; \ | 223 | const int in_linesize = in->linesize[plane]; \ |
| 224 | const int out_linesize = out->linesize[plane]; \ | 224 | const int out_linesize = out->linesize[plane]; \ |
| 225 | const int uv_linesize = s->uv_linesize[plane]; \ | ||
| 225 | const uint8_t *src = in->data[plane]; \ | 226 | const uint8_t *src = in->data[plane]; \ |
| 226 | uint8_t *dst = out->data[plane]; \ | 227 | uint8_t *dst = out->data[plane]; \ |
| 227 | const int width = s->planewidth[plane]; \ | 228 | const int width = s->planewidth[plane]; \ |
| @@ -232,9 +233,9 @@ static int remap##ws##_##bits##bit_slice(AVFilterContext *ctx, void *arg, int jo · 4 unmodified lines | |||
| 232 | \ | 233 | \ |
| 233 | for (int y = slice_start; y < slice_end; y++) { \ | 234 | for (int y = slice_start; y < slice_end; y++) { \ |
| 234 | const unsigned map = s->map[plane]; \ | 235 | const unsigned map = s->map[plane]; \ |
| 235 | const uint16_t *u = s->u[map] + y * width * ws * ws; \ | 236 | const uint16_t *u = s->u[map] + y * uv_linesize * ws * ws; \ |
| 236 | const uint16_t *v = s->v[map] + y * width * ws * ws; \ | 237 | const uint16_t *v = s->v[map] + y * uv_linesize * ws * ws; \ |
| 237 | const int16_t *ker = s->ker[map] + y * width * ws * ws; \ | 238 | const int16_t *ker = s->ker[map] + y * uv_linesize * ws * ws; \ |
| 238 | \ | 239 | \ |
| 239 | s->remap_line(dst + y * out_linesize, width, src, in_linesize, u, v, ker); \ | 240 | s->remap_line(dst + y * out_linesize, width, src, in_linesize, u, v, ker); \ |
| 240 | } \ | 241 | } \ |
| @@ -2035,12 +2036,12 @@ static inline void mirror(const float *modifier, float *vec) · 1794 unmodified lines | |||
| 2035 | 2036 | ||
| 2036 | static int allocate_plane(V360Context *s, int sizeof_uv, int sizeof_ker, int p) | 2037 | static int allocate_plane(V360Context *s, int sizeof_uv, int sizeof_ker, int p) |
| 2037 | { | 2038 | { |
| 2038 | s->u[p] = av_calloc(s->planewidth[p] * s->planeheight[p], sizeof_uv); | 2039 | s->u[p] = av_calloc(s->uv_linesize[p] * s->planeheight[p], sizeof_uv); |
| 2039 | s->v[p] = av_calloc(s->planewidth[p] * s->planeheight[p], sizeof_uv); | 2040 | s->v[p] = av_calloc(s->uv_linesize[p] * s->planeheight[p], sizeof_uv); |
| 2040 | if (!s->u[p] || !s->v[p]) | 2041 | if (!s->u[p] || !s->v[p]) |
| 2041 | return AVERROR(ENOMEM); | 2042 | return AVERROR(ENOMEM); |
| 2042 | if (sizeof_ker) { | 2043 | if (sizeof_ker) { |
| 2043 | s->ker[p] = av_calloc(s->planewidth[p] * s->planeheight[p], sizeof_ker); | 2044 | s->ker[p] = av_calloc(s->uv_linesize[p] * s->planeheight[p], sizeof_ker); |
| 2044 | if (!s->ker[p]) | 2045 | if (!s->ker[p]) |
| 2045 | return AVERROR(ENOMEM); | 2046 | return AVERROR(ENOMEM); |
| 2046 | } | 2047 | } |
| @@ -2266,6 +2267,9 @@ static int config_output(AVFilterLink *outlink) · 219 unmodified lines | |||
| 2266 | s->planewidth[1] = s->planewidth[2] = FF_CEIL_RSHIFT(w, desc->log2_chroma_w); | 2267 | s->planewidth[1] = s->planewidth[2] = FF_CEIL_RSHIFT(w, desc->log2_chroma_w); |
| 2267 | s->planewidth[0] = s->planewidth[3] = w; | 2268 | s->planewidth[0] = s->planewidth[3] = w; |
| 2268 | 2269 | ||
| 2270 | for (int i = 0; i < 4; i++) | ||
| 2271 | s->uv_linesize[i] = FFALIGN(s->planewidth[i], 8); | ||
| 2272 | |||
| 2269 | outlink->h = h; | 2273 | outlink->h = h; |
| 2270 | outlink->w = w; | 2274 | outlink->w = w; |
| 2271 | 2275 | ||
| @@ -2303,6 +2307,7 @@ static int config_output(AVFilterLink *outlink) · 31 unmodified lines | |||
| 2303 | // Calculate remap data | 2307 | // Calculate remap data |
| 2304 | for (p = 0; p < s->nb_allocated; p++) { | 2308 | for (p = 0; p < s->nb_allocated; p++) { |
| 2305 | const int width = s->planewidth[p]; | 2309 | const int width = s->planewidth[p]; |
| 2310 | const int uv_linesize = s->uv_linesize[p]; | ||
| 2306 | const int height = s->planeheight[p]; | 2311 | const int height = s->planeheight[p]; |
| 2307 | const int in_width = s->inplanewidth[p]; | 2312 | const int in_width = s->inplanewidth[p]; |
| 2308 | const int in_height = s->inplaneheight[p]; | 2313 | const int in_height = s->inplaneheight[p]; |
| @@ -2313,9 +2318,9 @@ static int config_output(AVFilterLink *outlink) · 4 unmodified lines | |||
| 2313 | 2318 | ||
| 2314 | for (i = 0; i < width; i++) { | 2319 | for (i = 0; i < width; i++) { |
| 2315 | for (j = 0; j < height; j++) { | 2320 | for (j = 0; j < height; j++) { |
| 2316 | uint16_t *u = s->u[p] + (j * width + i) * elements; | 2321 | uint16_t *u = s->u[p] + (j * uv_linesize + i) * elements; |
| 2317 | uint16_t *v = s->v[p] + (j * width + i) * elements; | 2322 | uint16_t *v = s->v[p] + (j * uv_linesize + i) * elements; |
| 2318 | int16_t *ker = s->ker[p] + (j * width + i) * elements; | 2323 | int16_t *ker = s->ker[p] + (j * uv_linesize + i) * elements; |
| 2319 | 2324 | ||
| 2320 | if (s->out_transpose) | 2325 | if (s->out_transpose) |
| 2321 | out_transform(s, j, i, height, width, vec); | 2326 | out_transform(s, j, i, height, width, vec); |