<!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,</p>
<p>On 2017-03-29 15:39, Steve Lhomme wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> ---
  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 */</code></pre>
</blockquote>
<p>The above check does not seem to match the reading that takes place in this block, as the actual reading potentially consumes <code>16*6 + 16*4 + 32 + 32 => 224</code>, wheras the current check uses <code>192</code>.</p>
<p>If the above is intentional it certainly deserves a comment.</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> +                    break;
 +                for ( size_t i = 0; i < 6 ; ++i)
 +                    sei_data.color_volume.primaries[i] = bs_read( &s, 16 );
 +                for ( size_t i = 0; i < 2 ; ++i)
 +                    sei_data.color_volume.white_point[i] = bs_read( &s, 16 );
 +                sei_data.color_volume.max_luminance = bs_read( &s, 32 );
 +                sei_data.color_volume.min_luminance = bs_read( &s, 32 );
 +                b_continue = pf_callback( &sei_data, cbdata );
 +            } break;
 +
              default:
                  /* Will skip */
                  break;
 diff --git a/modules/packetizer/hxxx_sei.h b/modules/packetizer/hxxx_sei.h
 index 7b53a578d0..58721aefca 100644
 --- a/modules/packetizer/hxxx_sei.h
 +++ b/modules/packetizer/hxxx_sei.h
 @@ -25,7 +25,9 @@ enum hxxx_sei_type_e
  {
      HXXX_SEI_PIC_TIMING = 1,
      HXXX_SEI_USER_DATA_REGISTERED_ITU_T_T35 = 4,
 -    HXXX_SEI_RECOVERY_POINT = 6
 +    HXXX_SEI_RECOVERY_POINT = 6,
 +    HXXX_SEI_MASTERING_DISPLAY_COLOUR_VOLUME = 137, /* SMPTE ST 2086 */
 +    HXXX_SEI_LIGHT_LEVEL = 144,
  };

  enum hxxx_sei_t35_type_e
 @@ -55,6 +57,13 @@ typedef struct
          {
              int i_frames;
          } recovery;
 +        struct
 +        {
 +            uint16_t primaries[3*2]; /* G,B,R / x,y */
 +            uint16_t white_point[2]; /* x,y */
 +            uint32_t max_luminance;
 +            uint32_t min_luminance;
 +        } color_volume;
      };
  } hxxx_sei_data_t;</code></pre>
</blockquote>
<p>Best Regards,<br />
Filip</p>
</body>
</html>