Skip to content

Remove fields in AV2CodecConfigurationBox - #40

Open
y-guyon wants to merge 2 commits into
mainfrom
y-guyon/remove_config_fields
Open

Remove fields in AV2CodecConfigurationBox#40
y-guyon wants to merge 2 commits into
mainfrom
y-guyon/remove_config_fields

Conversation

@y-guyon

@y-guyon y-guyon commented Jul 24, 2026

Copy link
Copy Markdown

No description provided.

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

📄 Specification Preview

The AV2 ISOBMFF specification has been built and published for this PR.

🔗 Live preview

The preview updates automatically on every push, and is removed when this PR is closed or merged.


Built from commit 75d8fb2 · Updated: Mon, 10 Aug 2026 14:02:39 GMT

github-actions Bot added a commit that referenced this pull request Jul 24, 2026
Comment thread index.bs
unsigned int(16) max_frame_width_minus_1;
unsigned int(16) max_frame_height_minus_1;

unsigned int(8) reserved1 = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My recommendation would be to add the following fields. This will allow us to extend this box by adding new fields after the configOBUs[] and make the parsing more deterministic.

bit(24) flags;
unsigned int(32) config_obus_length;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bit(24) flags;

  • Regarding the name, I do not mind using flags instead of reserved, but I do not see the benefit of it.
  • For the length, I would argue 8 bits is enough. It is rare for a box to need more than 8 flags, and even so more can be added in another field at the end of the box.

unsigned int(32) config_obus_length;

Good point. I was hoping everything would be handled by the contents of config_obus but it has to be flexible just in case.
To avoid adding 4 bytes to all AV2-ISOBMFF files forever "just in case", I can think of these alternatives:

  1. Use a flag bit to signal trailing fields:
    aligned(8) class AV2CodecConfigurationBox extends Box('av2C')
      unsigned int(8)  flags;
      if (flags & 1) {
        unsigned int(32) config_obus_length;
      }
      unsigned int(8)  config_obus[config_obus_length];
      if (flags & 1) {
        unsigned int(8)  reserved[];
      }
    }
  2. Use a flag bit to signal heading fields:
    aligned(8) class AV2CodecConfigurationBox extends Box('av2C')
      unsigned int(8)  flags;
      if (flags & 1) {
        unsigned int(32) reserved_length;
        unsigned int(8)  reserved[reserved_length];
      }
      unsigned int(8)  config_obus[];
    }
  3. I assume 256 OBUs to be enough (no need for flags because fields can be added at the end of the box in the future):
    aligned(8) class AV2CodecConfigurationBox extends Box('av2C')
      unsigned int(8) config_obus_count_minus1;
      for (i = 0; i <= config_obus_count_minus1; ++i) {
        unsigned int(8)  config_obu[];  // leb128() num_bytes_in_obu + a single OBU
      }
    }
  4. Variable-length length field (no need for flags because fields can be added at the end of the box in the future):
    aligned(8) class AV2CodecConfigurationBox extends Box('av2C')
      leb128() config_obus_length;  // Or similar behavior; ISOBMFF has no vl type defined so far
      unsigned int(8)  config_obus[config_obus_length];
    }
  5. Never append anything to AV2CodecConfigurationBox, but introduce a new box in AV2SampleEntry later if necessary:
    class AV2SampleEntry extends VisualSampleEntry('av02') {
      AV2CodecConfigurationBox config;
      AV2MultistreamCodecConfigurationBox multistream_config;
    }
    aligned(8) class AV2CodecConfigurationBox extends Box('av2C')
    {
      unsigned int(8)  reserved1 = 0;
      unsigned int(8)  config_obus[];  // Till end of box
    }
    aligned(8) class AV2MultistreamCodecConfigurationBox extends Box('av2M')
    {
      // whatever
    }

Any other approach in mind?

github-actions Bot added a commit that referenced this pull request Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants