History

avfilter/vf_blurdetect: fix uninitialized variables and possible div by zero

Thilo Borgmann committed 4 years ago

Commit 79286d31 parent 39f22df1 file · +2 −1Browse files

Unified · Split

libavfilter/vf_blurdetect.c+2−1
@@ -138,6 +138,7 @@ static float edge_width(BLRContext *blr, int i, int j, int8_t dir, int w, int h, · 137 unmodified lines
138 case DIRECTION_VERTICAL: dX = 0; dY = 1; break;138 case DIRECTION_VERTICAL: dX = 0; dY = 1; break;
139 case DIRECTION_45UP: dX = 1; dY = -1; break;139 case DIRECTION_45UP: dX = 1; dY = -1; break;
140 case DIRECTION_45DOWN: dX = 1; dY = 1; break;140 case DIRECTION_45DOWN: dX = 1; dY = 1; break;
141 default: dX = 1; dY = 1; break;
141 }142 }
142 143
143 // determines if search in direction dX/dY is looking for a maximum or minimum144 // determines if search in direction dX/dY is looking for a maximum or minimum
@@ -227,7 +228,7 @@ static float calculate_blur(BLRContext *s, int w, int h, int hsub, int vsub, · 83 unmodified lines
227 }228 }
228 }229 }
229 // if not enough edge pixels in a block, consider it smooth230 // if not enough edge pixels in a block, consider it smooth
230 if (block_total_width >= 2) {231 if (block_total_width >= 2 && block_count) {
231 blks[blkcnt] = block_total_width / block_count;232 blks[blkcnt] = block_total_width / block_count;
232 blkcnt++;233 blkcnt++;
233 }234 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t