Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed memory leak and calculation error in luminance term calculation #230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tools/dump_fastssim.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,14 @@ static void fs_downsample_level(fs_ctx *_ctx,int _l){
int j;
w=_ctx->level[_l].w;
h=_ctx->level[_l].h;
w = (w >> 1) << 1;
h = (h >> 1) << 1;
Comment on lines +124 to +125

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use bit shifting and not bitwise and operation here? I would expect this operation to give the same result and be simpler to read:

w &= ~1

dst1=_ctx->level[_l].im1;
dst2=_ctx->level[_l].im2;
w2=_ctx->level[_l-1].w;
h2=_ctx->level[_l-1].h;
w2 = (w2 >> 1) << 1;
h2 = (h2 >> 1) << 1;
src1=_ctx->level[_l-1].im1;
src2=_ctx->level[_l-1].im2;
for(j=0;j<h;j++){
Expand Down Expand Up @@ -241,7 +245,7 @@ static void fs_apply_luminance(fs_ctx *_ctx,int _l){
i0=FS_MAXI(0,i-4);
i1=FS_MINI(i+4,w-1);
mux+=col_sums_x[i1]-col_sums_x[i0];
muy+=col_sums_x[i1]-col_sums_x[i0];
muy+=col_sums_y[i1]-col_sums_y[i0];
}
}
if(j+1<h){
Expand Down