Message ID | 20240624172044.101722-1-ffmpeg@haasn.xyz |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/9] avcodec/dovi_rpudec: clarify semantics | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On Mon, 24 Jun 2024 19:20:36 +0200 Niklas Haas <ffmpeg@haasn.xyz> wrote: > From: Niklas Haas <git@haasn.dev> > > ff_dovi_rpu_parse() and ff_dovi_rpu_generate() are a bit inconsistent in > that they expect different levels of encapsulation, due to the nature of > how this is handled in the context of different APIs. Clarify the status > quo. (And fix an incorrect reference to the RPU payload bytes as 'RBSP') > --- > libavcodec/dovi_rpu.h | 5 +++-- > libavcodec/dovi_rpudec.c | 2 +- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/dovi_rpu.h b/libavcodec/dovi_rpu.h > index bfb118d6b5..205d16ffbc 100644 > --- a/libavcodec/dovi_rpu.h > +++ b/libavcodec/dovi_rpu.h > @@ -95,8 +95,9 @@ void ff_dovi_ctx_unref(DOVIContext *s); > void ff_dovi_ctx_flush(DOVIContext *s); > > /** > - * Parse the contents of a Dovi RPU NAL and update the parsed values in the > - * DOVIContext struct. > + * Parse the contents of a Dolby Vision RPU and update the parsed values in the > + * DOVIContext struct. This function should receive the decoded unit payload, > + * without any T.35 or NAL unit headers. > * > * Returns 0 or an error code. > * > diff --git a/libavcodec/dovi_rpudec.c b/libavcodec/dovi_rpudec.c > index c025800206..375e6e560b 100644 > --- a/libavcodec/dovi_rpudec.c > +++ b/libavcodec/dovi_rpudec.c > @@ -360,7 +360,7 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, > emdf_protection = get_bits(gb, 5 + 12); > VALIDATE(emdf_protection, 0x400, 0x400); > } else { > - /* NAL RBSP with prefix and trailing zeroes */ > + /* NAL unit with prefix and trailing zeroes */ > VALIDATE(rpu[0], 25, 25); /* NAL prefix */ > rpu++; > rpu_size--; > -- > 2.45.1 > Confirmed working via the official Dolby Bitstream validator tool. I'll merge it shortly if nobody objects. I made one more minor local change, renaming the default "all" compression preset to "limited", corresponding to the limited metadata compression scheme described in chapter 9 of the dolby vision bitstream specification. Specifically, we want to discourage the use of potential compression modes that go beyond "limited" because they are not broadly compatible with real devices, so having an "all" preset is a bit pointless.
diff --git a/libavcodec/dovi_rpu.h b/libavcodec/dovi_rpu.h index bfb118d6b5..205d16ffbc 100644 --- a/libavcodec/dovi_rpu.h +++ b/libavcodec/dovi_rpu.h @@ -95,8 +95,9 @@ void ff_dovi_ctx_unref(DOVIContext *s); void ff_dovi_ctx_flush(DOVIContext *s); /** - * Parse the contents of a Dovi RPU NAL and update the parsed values in the - * DOVIContext struct. + * Parse the contents of a Dolby Vision RPU and update the parsed values in the + * DOVIContext struct. This function should receive the decoded unit payload, + * without any T.35 or NAL unit headers. * * Returns 0 or an error code. * diff --git a/libavcodec/dovi_rpudec.c b/libavcodec/dovi_rpudec.c index c025800206..375e6e560b 100644 --- a/libavcodec/dovi_rpudec.c +++ b/libavcodec/dovi_rpudec.c @@ -360,7 +360,7 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, emdf_protection = get_bits(gb, 5 + 12); VALIDATE(emdf_protection, 0x400, 0x400); } else { - /* NAL RBSP with prefix and trailing zeroes */ + /* NAL unit with prefix and trailing zeroes */ VALIDATE(rpu[0], 25, 25); /* NAL prefix */ rpu++; rpu_size--;
From: Niklas Haas <git@haasn.dev> ff_dovi_rpu_parse() and ff_dovi_rpu_generate() are a bit inconsistent in that they expect different levels of encapsulation, due to the nature of how this is handled in the context of different APIs. Clarify the status quo. (And fix an incorrect reference to the RPU payload bytes as 'RBSP') --- libavcodec/dovi_rpu.h | 5 +++-- libavcodec/dovi_rpudec.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)