From: James Almer <jamrial@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [PATCH] tools: add an AV_CODEC_CAP_ENCODER_RECON_FRAME test tool Date: Fri, 21 Oct 2022 09:42:52 -0300 Message-ID: <e78b255a-f0ec-3729-42d1-aeaea7d00bea@gmail.com> (raw) In-Reply-To: <20221021083036.17264-1-anton@khirnov.net> On 10/21/2022 5:30 AM, Anton Khirnov wrote: > +static int frame_hash(FrameChecksum **pc, size_t *nb_c, int64_t ts, > + const AVFrame *frame) > +{ > + FrameChecksum *c; > + int shift_h, shift_v; > + > + c = av_realloc_array(*pc, *nb_c + 1, sizeof(*c)); Use av_fast_realloc(), or the size_t replacement if it's pushed before this. Or maybe port this to AVFifo with auto grow. Either case will reduce the amount of reallocations considerably. > + if (!c) > + return AVERROR(ENOMEM); > + *pc = c; > + (*nb_c)++; > + > + c += *nb_c - 1; > + memset(c, 0, sizeof(*c)); > + > + av_pix_fmt_get_chroma_sub_sample(frame->format, &shift_h, &shift_v); > + > + c->ts = ts; > + for (int p = 0; frame->data[p]; p++) { > + const uint8_t *data = frame->data[p]; > + int linesize = av_image_get_linesize(frame->format, frame->width, p); > + uint32_t checksum = 0; > + > + for (int j = 0; j < frame->height >> shift_v; j++) { Isn't the shift meant for the chroma planes only? > + checksum = av_adler32_update(checksum, data, linesize); > + data += frame->linesize[p]; > + } > + > + c->checksum[p] = checksum; > + } > + > + return 0; > +} _______________________________________________ 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".
prev parent reply other threads:[~2022-10-21 12:43 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-18 11:51 [FFmpeg-devel] [PATCH 1/3] tools/decode_simple: always call process_frame(NULL) at the end Anton Khirnov 2022-10-18 11:51 ` [FFmpeg-devel] [PATCH 2/3] tools/decode_simple: initialize decoder parameters with container info Anton Khirnov 2022-10-18 11:51 ` [FFmpeg-devel] [PATCH 3/3] tools: add an AV_CODEC_CAP_ENCODER_RECON_FRAME test tool Anton Khirnov 2022-10-18 12:11 ` James Almer 2022-10-21 8:30 ` [FFmpeg-devel] [PATCH] " Anton Khirnov 2022-10-21 12:42 ` James Almer [this message]
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=e78b255a-f0ec-3729-42d1-aeaea7d00bea@gmail.com \ --to=jamrial@gmail.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