Subject: [quicwg/base-drafts] Do we need two ways to represent Base Index? (#2002)

From: Kazuho Oku <[email-masked]>
Date: Wed, 14 Nov 2018 01:46:41 -0800

At the moment, there are two ways to Base Index identical to Largest Reference: use (S, Delta Base Index) = (1, 0) or (0, 0).

Would it be better to add one offset when the sign bit is set, i.e. change
```
   if sign == 0:
      baseIndex = largestReference + deltaBaseIndex
   else:
      baseIndex = largestReference - deltaBaseIndex
```
to
```
   if sign == 0:
      baseIndex = largestReference + deltaBaseIndex
   else:
      baseIndex = largestReference - deltaBaseIndex - 1
```
?

I ask this because IMO we have an inconsistency; Post Base Index has this type of offset so that a Post Base Index of zero does not become equal to Relative Index of zero.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/issues/2002

---

From: Martin Thomson <[email-masked]>
Date: Wed, 14 Nov 2018 03:34:18 -0800

Hmm, diagrams suggest that we already have the latter form.  My code might not be interoperable, but it subtracts the extra 1 already.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/issues/2002#issuecomment-438632165

---

From: Kazuho Oku <[email-masked]>
Date: Wed, 14 Nov 2018 04:21:07 -0800

@martinthomson 
> Hmm, diagrams suggest that we already have the latter form. My code might not be interoperable, but it subtracts the extra 1 already.

The ones with the diagram; i.e. Post Base Index that appears in the request and push streams is OK.

However, the Delta Base Index calculated in [section 5.4.1](https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#rfc.section.5.4.1) is missing the "subtract the extra 1." That is what I am complaining.

> Oh, have I mentioned recently that I hate post-base indexing? Could we perhaps reconsider its addition and have any single-pass encoder lose any opportunity to use insertions it makes after committing to a largest reference? Maybe I should open another issue.

I think it might be sensible to open a new issue for the purpose.

Even though I have an implementation that emits post-base indexing (for the time being), I agree that it  is an unnecessary complexity at least in the current form. Because in the current form, even if you emit the headers in single pass, you still need to adjust the Header Data Prefix afterwards so that Largest Reference will include the correct value. To put it another way, it is impossible to write a "streaming encoder."

Therefore, my preference goes to either removing post-base indexing, or to removing "Largest Reference" to allow true one-pass encoding (i.e. streaming encoding). In the latter case, every decoder can / will check if an unresolvable reference is included in each of the header field rather than relying on "Largest Reference."

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/issues/2002#issuecomment-438643525

---

From: Dmitri Tikhonov <[email-masked]>
Date: Wed, 14 Nov 2018 05:34:29 -0800

This is not true.  The draft states:

> _A sign bit set to 1 when the Delta Base Index is 0 MUST be treated as a decoder error._

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/issues/2002#issuecomment-438663204

---

From: Dmitri Tikhonov <[email-masked]>
Date: Wed, 14 Nov 2018 05:40:16 -0800

> Oh, have I mentioned recently that I hate post-base indexing?

Why do you hate it?

> Could we perhaps reconsider its addition and have any single-pass encoder lose any opportunity to use insertions it makes after committing to a largest reference? Maybe I should open another issue.

I am against both reconsidering and removing post-base indexing: the former because we already had this discussion and came to a consensus (however "rough") and the latter is because this would penalize already-extant implementations that use this feature profitably.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/issues/2002#issuecomment-438664918

---

From: Kazuho Oku <[email-masked]>
Date: Wed, 14 Nov 2018 05:53:04 -0800

@dtikhonov 
>> A sign bit set to 1 when the Delta Base Index is 0 MUST be treated as a decoder error.

Oh thank you for pointing that out. I missed that.

Though I still think that we have an inconsistency in the design. As pointed out, post-base indexing in the request and push streams do not call index of zero to be an error. Instead, they adjust the offset so that a post-base index of zero do not overlap with a non-post-base index with zero. Should we follow the pattern for the delta base index as well?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/issues/2002#issuecomment-438668861

---

From: Dmitri Tikhonov <[email-masked]>
Date: Wed, 14 Nov 2018 05:57:25 -0800

I agree that inconsistency exists.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/issues/2002#issuecomment-438670272