<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title></title>
  <style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<p>Hi Steve and Francois,</p>
<p>On 2017-03-29 17:02, Steve Lhomme wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> On Wed, Mar 29, 2017 at 4:56 PM, Filip Roséen <filip@atch.se> wrote:</code></pre>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> Hi Steve,

 On 2017-03-29 15:39, Steve Lhomme wrote:

  ---
   modules/packetizer/hxxx_sei.c | 14 ++++++++++++++
   modules/packetizer/hxxx_sei.h | 11 ++++++++++-
   2 files changed, 24 insertions(+), 1 deletion(-)

  diff --git a/modules/packetizer/hxxx_sei.c b/modules/packetizer/hxxx_sei.c
  index e83528cb7c..636c7178cf 100644
  --- a/modules/packetizer/hxxx_sei.c
  +++ b/modules/packetizer/hxxx_sei.c
  @@ -145,6 +145,20 @@ void HxxxParseSEI(const uint8_t *p_buf, size_t i_buf,
                   b_continue = pf_callback( &sei_data, cbdata );
               } break;

  +            case HXXX_SEI_MASTERING_DISPLAY_COLOUR_VOLUME:
  +            {
  +                if ( bs_remain( &s ) < (16*4*2+32+32))
  +                    /* not enough data */

 The above check does not seem to match the reading that takes place in this
 block, as the actual reading potentially consumes 16*6 + 16*4 + 32 + 32 =>
 224, wheras the current check uses 192.</code></pre>
</blockquote>
<pre><code> Nope, the second is 16*2, not 16*4.</code></pre>
</blockquote>
<p>Oh yeah right, I completely misread the loop conditions and/or calculations for some reason; sorry about that.</p>
<p>Though I must say that the expression used to calculate the minimum number of bits is rather odd. The expression <code>16*4*2</code> is course is equivalent to <code>16*8</code> (where <code>8</code> denotes the total number of 16-bit reads), but it implies code logic that does not reflect what is coming.</p>
<p>In my opinion, especially given the brainfart the expression caused in my brain, it would be far easier to reason about (and maintain) <code>16*(4 + 2) + 32 + 32</code>, or the more verbose (but more in-line with the implementation) <code>16*4 + 16*2 + 32 + 32</code>.</p>
<p>The above is nitpicking in its most basic form, and I guess I am just trying to salvage whatever insanity it might have (or might not have) left.</p>
<p>Best Regards,<br />
Filip</p>
</body>
</html>