Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -266,11 +266,12 @@ static void interpolate_##ss(ESTDIFContext *s, uint8_t *ddst, \ · 265 unmodified lines | ||
| 266 | 266 | const type *const next3_line = (const type *const)nnext3_line; \ |
| 267 | 267 | const int interp = s->interp; \ |
| 268 | 268 | const int ecost = s->ecost; \ |
| 269 | − const int dcost = s->dcost * s->max; \ | |
| 270 | − const int end = width - 1; \ | |
| 269 | + const int dcost = s->dcost; \ | |
| 271 | 270 | const int mcost = s->mcost; \ |
| 272 | 271 | atype sd[S], sD[S], di = 0; \ |
| 272 | + const int end = width - 1; \ | |
| 273 | 273 | atype dmin = amax; \ |
| 274 | + int id = 0, iD = 0; \ | |
| 274 | 275 | int k = *K; \ |
| 275 | 276 | \ |
| 276 | 277 | for (int i = -rslope; i <= rslope && abs(k) > rslope; i++) { \ |
| @@ -288,7 +289,11 @@ static void interpolate_##ss(ESTDIFContext *s, uint8_t *ddst, \ · 11 unmodified lines | ||
| 288 | 289 | sD[i + rslope] += mcost * cost_##ss(prev_line, next_line, end, x, i);\ |
| 289 | 290 | sD[i + rslope] += dcost * abs(i); \ |
| 290 | 291 | \ |
| 291 | − dmin = FFMIN(sD[i + rslope], dmin); \ | |
| 292 | + if (dmin > sD[i + rslope]) { \ | |
| 293 | + dmin = sD[i + rslope]; \ | |
| 294 | + di = 1; \ | |
| 295 | + iD = i; \ | |
| 296 | + } \ | |
| 292 | 297 | } \ |
| 293 | 298 | \ |
| 294 | 299 | for (int i = -rslope; i <= rslope; i++) { \ |
| @@ -306,23 +311,14 @@ static void interpolate_##ss(ESTDIFContext *s, uint8_t *ddst, \ · 11 unmodified lines | ||
| 306 | 311 | sd[i + rslope] += mcost * cost_##ss(prev_line, next_line, end, x, k+i);\ |
| 307 | 312 | sd[i + rslope] += dcost * abs(k + i); \ |
| 308 | 313 | \ |
| 309 | − dmin = FFMIN(sd[i + rslope], dmin); \ | |
| 310 | − } \ | |
| 311 | − \ | |
| 312 | − for (int i = -rslope; i <= rslope && abs(k) > rslope; i++) { \ | |
| 313 | − if (dmin == sD[i + rslope]) { \ | |
| 314 | − di = 1; \ | |
| 315 | − k = i; \ | |
| 316 | − break; \ | |
| 314 | + if (dmin > sd[i + rslope]) { \ | |
| 315 | + dmin = sd[i + rslope]; \ | |
| 316 | + di = 0; \ | |
| 317 | + id = i; \ | |
| 317 | 318 | } \ |
| 318 | 319 | } \ |
| 319 | 320 | \ |
| 320 | − for (int i = -rslope; i <= rslope && !di; i++) { \ | |
| 321 | − if (dmin == sd[i + rslope]) { \ | |
| 322 | − k += i; \ | |
| 323 | − break; \ | |
| 324 | − } \ | |
| 325 | − } \ | |
| 321 | + k = di ? iD : k + id; \ | |
| 326 | 322 | \ |
| 327 | 323 | dst[x] = s->mid_##ss[interp](prev_line, next_line, \ |
| 328 | 324 | prev2_line, next2_line, \ |