-
Notifications
You must be signed in to change notification settings - Fork 1
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
h264: using consts in MbPartPredMode function #25
Conversation
errPartition = errors.New("partition must be 0") | ||
) | ||
|
||
func MbPartPredMode(data *SliceData, sliceType string, mbType, partition int) (mbPartPredMode, error) { |
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.
Please don't make exported functions return unexported types.
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 function was already exported, and thought changing it would have been out of scope of the PR.
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.
Sure, but the return type could have been exported.
} | ||
return modeName | ||
return -1, errPartition |
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.
-1
can have a name.
@@ -20,11 +20,16 @@ import ( | |||
"github.com/pkg/errors" | |||
) | |||
|
|||
type macroblockPredictionMode uint8 | |||
type mbPartPredMode int8 |
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.
Is there a reason for reducing the length of this name?
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.
I'm trying to keep the naming more consistent with the specs.
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.
Clarity is more important than matching the spec; if matching the spec helps, do it, otherwise improve on it. A good example is the crypto/tls package and its constants/field names compared with the relevant RFCs.
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.
I really think matching the specs as much as possible (unless it breaks go style) is good. It helps to find things in the spec more easily.
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.
I disagree.
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.
Okay, i'll move away from that idea. Please take a look at the code and create issues if you see naming that could be better.
modeName := "UnknownPartPredMode" | ||
// Errors used by MbPartPredMode. | ||
var ( | ||
errNaMode = errors.New("no mode for given slice and mb type") |
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.
Comments for these?
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.
what kind of comments do they need ?
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.
Explaining what they mean?
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.
issues created
|
||
const ( | ||
intra4x4 macroblockPredictionMode = iota | ||
intra4x4 mbPartPredMode = iota |
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.
I think these names could be better.
Resolves #14
Replacing usage of strings to represent macroblock partition prediction modes with int8 consts. Also made changes to affected code.