From: "Dawid Kozinski/Multimedia \(PLT\) /SRPOL/Staff Engineer/Samsung Electronics" <d.kozinski@samsung.com>
To: "'FFmpeg development discussions and patches'" <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v23 04/10] avformat/evc_demuxer: Added demuxer to handle reading EVC video files
Date: Wed, 7 Jun 2023 15:36:10 +0200
Message-ID: <007601d99945$05594570$100bd050$@samsung.com> (raw)
In-Reply-To: <60cedee7-fe0e-8764-42d5-241875adaab5@gmail.com>
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of James
> Almer
> Sent: poniedziałek, 29 maja 2023 15:08
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v23 04/10] avformat/evc_demuxer: Added
> demuxer to handle reading EVC video files
>
> On 5/26/2023 7:31 AM, Dawid Kozinski wrote:
> > +static int get_temporal_id(const uint8_t *bits, int bits_size) {
> > + int temporal_id = 0;
> > + short t = 0;
> > +
> > + if (bits_size >= EVC_NALU_HEADER_SIZE) {
> > + unsigned char *p = (unsigned char *)bits;
> > + // forbidden_zero_bit
> > + if ((p[0] & 0x80) != 0)
> > + return -1;
> > +
> > + for (int i = 0; i < EVC_NALU_HEADER_SIZE; i++)
> > + t = (t << 8) | p[i];
>
> I think this can be replaced with AV_RB16.
>
> > +
> > + temporal_id = (t >> 6) & 0x0007;
> > + }
> > +
> > + return temporal_id;
> > +}
>
> [...]
>
> > +static uint32_t read_nal_unit_length(const uint8_t *bits, int
> > +bits_size) {
> > + uint32_t nalu_len = 0;
> > +
> > + if (bits_size >= EVC_NALU_LENGTH_PREFIX_SIZE) {
> > +
> > + int t = 0;
> > + unsigned char *p = (unsigned char *)bits;
> > +
> > + for (int i = 0; i < EVC_NALU_LENGTH_PREFIX_SIZE; i++)
> > + t = (t << 8) | p[i];
>
> AV_RB32.
>
> > +
> > + nalu_len = t;
> > + if (nalu_len == 0) // Invalid bitstream size
> > + return 0;
> > + }
> > +
> > + return nalu_len;
> > +}
>
> [...]
>
> > +static int evc_frame_merge_filter(AVBSFContext *bsf, AVPacket *out) {
> > + EVCMergeContext *ctx = bsf->priv_data;
> > + AVPacket *in = ctx->in;
> > +
> > + int free_space = 0;
> > + size_t nalu_size = 0;
> > + uint8_t *nalu = NULL;
> > + int au_end_found = 0;
> > + int err;
> > +
> > + err = ff_bsf_get_packet_ref(bsf, in);
> > + if (err < 0)
> > + return err;
> > +
> > + nalu_size = read_nal_unit_length(in->data,
> EVC_NALU_LENGTH_PREFIX_SIZE);
> > + if(nalu_size <= 0) {
> > + av_packet_unref(in);
> > + return AVERROR_INVALIDDATA;
> > + }
> > +
> > + nalu = in->data + EVC_NALU_LENGTH_PREFIX_SIZE;
> > + nalu_size = in->size - EVC_NALU_LENGTH_PREFIX_SIZE;
> > +
> > + // NAL unit parsing needed to determine if end of AU was found
> > + err = parse_nal_unit(nalu, nalu_size, bsf);
> > + if (err < 0) {
> > + av_log(bsf, AV_LOG_ERROR, "NAL Unit parsing error\n");
> > + av_packet_unref(in);
> > +
> > + return err;
> > + }
> > +
> > + au_end_found = end_of_access_unit_found(bsf);
> > +
> > + free_space = ctx->au_buffer.capacity - ctx->au_buffer.data_size;
> > + while( free_space < in->size ) {
> > + ctx->au_buffer.capacity *= 2;
> > + free_space = ctx->au_buffer.capacity -
> > + ctx->au_buffer.data_size;
> > +
> > + if(free_space >= in->size) {
> > + ctx->au_buffer.data = av_realloc(ctx->au_buffer.data, ctx-
> >au_buffer.capacity);
> > + }
> > + }
> > +
> > + memcpy(ctx->au_buffer.data + ctx->au_buffer.data_size, in->data,
> > + in->size);
>
> This is including the Annex-B's nal_unit_lenght value into the assembled
packet. I
> assume libxevd expects this? Also, is it defined as part of the ISOBMFF
> encapsulation? Patch 07/10 does not seem to strip it.
Could you expand on this topic?
What do you mean by "Patch 07/10 does not seem to strip it"?
Patch 7/10 expands the implementation of the MOV Muxer to support the EVC
stream.
The function ff_isom_write_evcc parses the received data, extracts NAL units
of types SPS, PPS, APS, SEI, and inserts their contents into the
corresponding elements of the arrays array, which is a component of the
EVCDecoderConfigurationRecord structure. Additionally, the
ff_isom_write_evcc function populates the relevant fields of the
EVCDecoderConfigurationRecord structure based on the parsed SPS NAL unit
data, and then calls the evcc_write function, which writes the
EVCDecoderConfigurationRecord to the stream.
It seems that I don't understand what's wrong with our implementation ( I
mean MOV muxer for EVC) and it seems I need your help in this matter. I need
an explanation of what's wrong and what should be done to fix the issue.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://protect2.fireeye.com/v1/url?k=d9b5596c-b83e4c5f-d9b4d223-
> 000babff9bb7-060f807600ae9b45&q=1&e=9deb391f-9dfe-412c-b7d8-
> 09a65325c2ec&u=https%3A%2F%2Fffmpeg.org%2Fmailman%2Flistinfo%2Fffmp
> eg-devel
>
> To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org
> with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-06-07 13:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230526103158eucas1p1e8b2adfc43aaf57c62e23e78571df817@eucas1p1.samsung.com>
2023-05-26 10:31 ` Dawid Kozinski
2023-05-29 13:07 ` James Almer
2023-06-07 13:36 ` Dawid Kozinski/Multimedia (PLT) /SRPOL/Staff Engineer/Samsung Electronics [this message]
2023-06-07 13:39 ` James Almer
2023-06-07 15:41 ` Dawid Kozinski/Multimedia (PLT) /SRPOL/Staff Engineer/Samsung Electronics
2023-06-07 16:30 ` Dawid Kozinski/Multimedia (PLT) /SRPOL/Staff Engineer/Samsung Electronics
2023-06-07 16:37 ` James Almer
2023-06-07 22:11 ` Dawid Kozinski/Multimedia (PLT) /SRPOL/Staff Engineer/Samsung Electronics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='007601d99945$05594570$100bd050$@samsung.com' \
--to=d.kozinski@samsung.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git