Hi, I thought I had answered here already, but looks I never sent the email. On Sat 05 Oct 19, 23:21, Tomasz Figa wrote: > On Sat, Oct 5, 2019 at 11:12 PM Paul Kocialkowski > <paul.kocialkowski@xxxxxxxxxxx> wrote: > > > > On Sat 05 Oct 19, 22:54, Tomasz Figa wrote: > > > On Sat, Oct 5, 2019 at 10:39 PM Paul Kocialkowski > > > <paul.kocialkowski@xxxxxxxxxxx> wrote: > > > > > > > > Hi, > > > > > > > > On Sat 05 Oct 19, 17:22, Tomasz Figa wrote: > > > > > On Fri, Oct 4, 2019 at 6:12 AM Paul Kocialkowski > > > > > <paul.kocialkowski@xxxxxxxxxxx> wrote: > > > > > > > > > > > > Hi, > > > > > > > > > > > > On Thu 05 Sep 19, 13:42, Philipp Zabel wrote: > > > > > > > To explain why num_ref_idx_active_override_flag is not part of the API, > > > > > > > describe how the num_ref_idx_l[01]_active_minus1 fields and the > > > > > > > num_ref_idx_l[01]_default_active_minus1 fields are used, depending on > > > > > > > whether the decoder parses slice headers itself or not. > > > > > > > > > > > > Is there any particular reason why this is preferable to exposing the flag? > > > > > > It feels like having the flag around sticks closer to the bitstream, > > > > > > so it's more straightforward for everyone. > > > > > > > > > > > > In case there's only one set of fields exposed by the hardware (and it doesn't > > > > > > do slice parsing itself), we could always check the flag in the driver and use > > > > > > either the default PPS values or the slice-specific values there. > > > > > > > > > > > > What do you think? > > > > > > > > > > IMHO it would only add further logic to the drivers, because they > > > > > would need to have a conditional block that selects default or > > > > > per-slice value based on the flag. The goal was to be able for the > > > > > driver to just passively write num_ref_idx_l[01]_active_minus1 (or the > > > > > default one for slice-parsing hardware) to corresponding hardware > > > > > registers. > > > > > > > > Well, the Allwinner block has both set of fields and a field for the flag, > > > > so in this case I find that it is cleaner to just copy the values and flag > > > > rather than always setting the flag even when it's the default value used. > > > > > > > > More generally, the two sets + flag are closer to bitstream which feels less > > > > confusing than re-purposing these fields from the slice header to fit the > > > > result of flag ? per-slice : per-picture. > > > > > > > > > We're talking about kernel drivers here and for security reasons any > > > > > logic should be reduced to the strictly necessary minimum. > > > > > > > > I definitely agree that bitstream parsing in the kernel is to be avoided for > > > > security reasons (among other things), but don't see the harm in considering > > > > the flags in-driver if needed. We do it for a number of other flags already > > > > (and strongly need to). > > > > > > If the fields are well documented, does it really matter? I'd suggest > > > just keeping it as is, rather than overpolishing things and preventing > > > the interface from stabilizing. > > > > I just don't see the benefit of changing the purpose of a bitstream element. > > Even with documentation, it adds some unnecessary confusion and I find this to > > be a complicated enough topic without it ;) > > > > Especially for the case of hardware that does slice header parsing itself, it > > feels particularly unsettling to have to take the default PPS values for the > > fields from the slice header control rather than PPS. > > num_ref_idx_l[01]_default_active_minus1 are members of v4l2_ctrl_h264_pps. Sorry, I got confused here and lost sight of the fact that the two members are already part of the structures. So my point here is to introduce the flag and have drivers use it to select between the two values. > > The bottomline is that we have use cases for each of the two set of fields > > independently, so I feel like this is reason enough to avoid mixing them > > together. > > What do you mean by mixing together? Hardware parsing the slices > always uses num_ref_idx_l[01]_default_active_minus1 from the PPS. > Hardware not parsing the slices always sets override to 1 and uses > num_ref_idx_l[01]_active_minus1 from the slice header struct. To summarize, what I don't understand is why it's worth re-purposing the slice header's num_ref_idx_l[01]_active_minus1 to contain num_ref_idx_l[01]_default_active_minus1 when the flag is not set in the initial bitstream instead of exposing the flag. There's hardware (like cedrus) which takes both fields and the flag directly in-registers, so it's really not a simplification here. And even in cases where the hardware only takes one field, I believe that the downside of re-purposing the field of the control is much greater than the benefit of the supposed simplification. I know this sounds quite futile, but I thought there was an implicit agreement that controls must stick as close as possible to the bitstream. This is an occurence where we are diverging for no particularly strong reason. Expecting that userspace does this pre-processing of fields feels quite counter-intuitive and confusing for people wishing to use the API, too. One would certainly naively expect that the fields in the controls carry the same meaning as in the bitstream when they have the same name. > > We are still in the process of polishing the API anyway, so now feels like a > > good time to change these things. > > Hmm, it seemed to me like things already calmed down and we were just > polishing the documentation. I was convinced we were actually about to > destage things. Are you aware of some other changes coming? From my perspective, we still lack a few things: - Coverage testing of the current controls against a large number of bitstreams; - Making sure that the current controls cover all the bitstream features we want to support in this API and take a decision about what we explicitly decide to exclude if needed; - We need a stateless (i.e. not firmware-backed) encoder supported; - Maybe having formal rules regarding how to adapt codec bitstream elements to controls would also be nice. So tl;dr, I don't think we're at a point where things are sufficiently well-defined to consider destaging. So that's why I feel like we should take the chance to keep polish things (especially small details like the one discussed here, which will set a precedent for how to do things in the future). What do you think?
Attachment:
signature.asc
Description: PGP signature