I asked some people on Reddit to review my first Rust program. They had some useful insight to offer, but also complained that they didn't understand what the _eotf_, _oetf_, and _ootf_ variables meant and were therefore obscure. If you don't know what those are, you shouldn't be working on the code.
Announcement
Collapse
No announcement yet.
Rav1e Sees New Pre-Release With More Speed-Ups, Monochrome Support
Collapse
X
-
Originally posted by wswartzendruber View PostI asked some people on Reddit to review my first Rust program. They had some useful insight to offer, but also complained that they didn't understand what the _eotf_, _oetf_, and _ootf_ variables meant and were therefore obscure. If you don't know what those are, you shouldn't be working on the code.
You do have a point in that there's always domain specific stuff that doesn't need to be explained left and right, but the attitude of "you can't X you shouldn't be doing Y" is among the most toxic attitudes one can have on a team.
And even for domain specific terms, I'd still link to some wiki page, RFC or something. Obviously not in the source code, but maybe in a readme file or something. It's amazing how often people will come up with their own definitions for the most established of terms (just today I had to point out there is a difference between "acceptance criteria" and "definition of done" - I don't think I got through).
Comment
-
Originally posted by bug77 View Post
Yes, that's the spirit
You do have a point in that there's always domain specific stuff that doesn't need to be explained left and right, but the attitude of "you can't X you shouldn't be doing Y" is among the most toxic attitudes one can have on a team.
Originally posted by bug77 View Post
And even for domain specific terms, I'd still link to some wiki page, RFC or something. Obviously not in the source code, but maybe in a readme file or something. It's amazing how often people will come up with their own definitions for the most established of terms (just today I had to point out there is a difference between "acceptance criteria" and "definition of done" - I don't think I got through).
So there are citations in the source itself telling you exactly where these values come from. EOTF, OETF, and OOTF are universally understood terms within video DSP.
Comment
-
Originally posted by wswartzendruber View PostSo there are citations in the source itself telling you exactly where these values come from. EOTF, OETF, and OOTF are universally understood terms within video DSP.
When working on projects that are higher level, making up non-standard variable names for being terse with no explanation is where it can be a real problem, because it's not tied to a specific field. There is a big difference there that people with an issue about such don't seem to get.
But to be fair, you were asking for people to review your Rust code, and without that domain knowledge they may have a harder time grokking what is going on, they're not going to want to look too deeply into it and acquire domain knowledge they have no need for themselves. Your code is all in a single main.rs file, so it wouldn't be too much of an issue to guide the reviewers a bit more? Those 3 functions and their tests could even be extracted to a separate file/mod to import, as that appears to be where the majority of domain jargon with your naming is.
I tried rustfmt on the input/output vars at line 87, and the output was pretty bad.. At first it looked a bit weird to me with the ending indentation from grouping `})` to a single line, but I guess what you did reads fine/better than splitting the `)` to the next line or reducing the indentation.
Originally posted by wswartzendruber View PostIf you don't know what those are, you shouldn't be working on the code.Last edited by polarathene; 19 May 2020, 12:55 AM.
Comment
-
Originally posted by starshipeleven View PostThere is a ton of inline assembler like this https://github.com/xiph/rav1e/blob/m...4/loopfilter.S that of course looks like ass, but there is no real way around that, these projects do need assembler as they are full of performance-critical code.
But for the actual high-level code like for example this https://github.com/xiph/rav1e/blob/m...rc/quantize.rs I don't see much of the problems. For example yes it uses a a b c d as symbol names, but it's internal variables of a 5-line function doing a specific job, for longer functions it uses decent variable names. There is also verbose comments explaining what is going on.
At least from my quick look and limited programming experience, it does not look bad. Or at least I've seen so awful shit in PHP and java that this looks great in comparison.
They tend to look like a hot mess (still very subjective), irrespective of language.
My comment with with rav1e was more that "Rust does not make the code prettier"... Which is a rather stupid analysis.
The line of thoughts was something like:
"Hmm. I wonder if breaking with old languages would also give a "prettier" situation (beside the touted advantages). Hmm. No."
In truth, yes you are right, it is better than a lot of other encoders, so perhaps unnecessarily harsh with the words.
But still, to my eyes, they look like a mess.
Maybe encoders just don't lend themselves to being written as pretty code (subjective)?
Comment
-
Originally posted by polarathene View Post
What is wrong with the indentation? It's using the language formatter, so it should be pretty standard if you work on Rust code. You can always have that transformed to an appropriate indentation you're comfortable with while viewing or working on it, not a difficult thing to do.
Naming of variables and symbols? See prior post explaining a few snippets someone else pointed out as seeming poor quality. It's quite likely the same applies to whatever you're not happy about, lack of domain knowledge. I don't know some of it but it wasn't hard to figure out, and once I did those names made sense and I'd know them if I had the skills to contribute to such, so non-issue. Perhaps you saw something where that doesn't apply though?
Not sure what you're referring to by non-obvious/hiding control flow. Looks fairly standard to me at a glance, could it just be you're not that familiar with rust so it looks "off" to you?
Code structure issues in what way? Breaking logic into smaller functions that are composed instead of nested or utilizing something like inheritance? Or are you also referring to file structure/hierarchy (which seems fairly decent at a glance imo). Again, it's possible you're viewing this with some personal bias of what is right is what you're comfortable with, and it may not necessarily apply well to a project like this one.
I've seen horrid shit before, and this is not that.
Not more than "Writing it in Rust does not seem to help my view on what encoders look like".
I still think that most encoders fail miserably at looking (subjectively) like good code to me.
I have a good base in signal math education and I have no trouble understanding most concepts in encoders.
I've also worked quite a bit with media type problems, mostly streaming and encoding.
And it might be that my personal bias of what good code should look like does not apply here.
Or to this type of problem in general (encoders in general).
Maybe I should spend some time writing my own encoder instead.
I'm actually looking for a very specific type of AVC encoder (not HVEC) to solve a very specific problem in software,
but there is none... So maybe a window of opportunity?
- Likes 1
Comment
-
Originally posted by milkylainen View PostI still think that most encoders fail miserably at looking (subjectively) like good code to me.
I have a good base in signal math education and I have no trouble understanding most concepts in encoders.
I've also worked quite a bit with media type problems, mostly streaming and encoding.
Comment
-
Originally posted by milkylainen View PostIt was nothing against rav1e specifically. But a general comment towards a lot of encoders.
They tend to look like a hot mess (still very subjective), irrespective of language.
You said it looks bad to you, which per-se means nothing. We understand you said that and asked for clarifications. Repeating the same concept 5 times in another post isn't an answer to that.
Comment
Comment