-
Notifications
You must be signed in to change notification settings - Fork 252
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
Reduce risk of uninit ac in luma_ac and encode_coeffs #3271
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
📢 Thoughts on this report? Let us know!. |
It looks very nice, but I'd like to have @barrbrain opinion :) |
Thanks for x86 fixes. As you can see, I'm on ARM, and conditionally-compiled x86 is a blind spot for me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe doing a quick AWCY run is a good idea too:)
I don't expect this to change outputs at all. Hopefully tests already cover this, but you can verify by running compression and check file hashes before/after. |
Unfortunately, we have build issues on AWCY presently. ffmpeg -loglevel error -f lavfi -i testsrc=duration=10:size=320x240:rate=30 \
-pix_fmt yuv420p -f yuv4mpegpipe - | rav1e -o >(sha256sum) -y - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes relating to scan order required close review. Everything else looked good to me at a cursory glance. Thank you for this effort.
luma_ac
In various
pred_cfl_ac
I've added checks thatac[..].len()
must be exactly as long as needed, i.e.plane_bsize.width() * plane_bsize.height()
. The multiplication got repetitive, so I've addedplane_bsize.area()
.Those prediction functions are in assembly. I haven't checked whether they initialize exactly
plane_bsize.area()
and nothing else, but I don't see a reason why they wouldn't, it would be a bug otherwise. Anyway, it's not a safety issue in pratice, since the allocated memory behindac
is the same size as before.encode_coeffs
get_nz_map_contexts
initializes context up toeob
which isu16
. Other code usedusize
foreob
. To be type-safe sure it can't be longer thanu16
anywhere (therefore reading past whatget_nz_map_contexts
could init), I've changedeob
to be consistentlyu16
everywhere. It's never more than 1024 in reality.get_nz_map_contexts
used to writecoeffs[scan[i]]
, but that had two issues:scan
's positions was a needless step, because they were also always read ascoeffs[scan[i]]
. Since all uses of thecoeffs
wanted a coefficient forscan[i]
, I've made them get it fromcoeffs[i]
rather thancoeffs[scan[i]]
.scan
acted only as an unnecessary shuffle. This is faster, guarantees a contiguous slice, and does not change the behavior.