[FFmpeg-devel] [PATCH] Extract QP from h264 encoded videos
Michael Niedermayer
michael at niedermayer.cc
Tue Jul 30 21:59:12 EEST 2019
On Tue, Jul 30, 2019 at 10:49:00AM -0700, Juan De León wrote:
> On Mon, Jul 29, 2019 at 7:59 PM James Almer <jamrial at gmail.com> wrote:
>
> > Side data, or more specifically, any AVBufferRef, must be a flat array.
> > You can't have pointers to some other allocated buffer within them since
> > you can't really control their lifetime.
> >
> Here's a snippet of how I'm doing it right now:
> // mb_xy = number of blocks in the frame
> size_t buf_size = sizeof(AVQuantizationParamsArray) + mb_xy *
> sizeof(AVQuantizationParams);
> AVBufferRef *buffer = av_buffer_alloc(buf_size);
> AVQuantizationParamsArray *params = (AVQuantizationParamsArray
> *)buffer->data;
>
> // offset memory for qp_block_array in same buffer
> params->qp_block_array = (AVQuantizationParams*) (params + 1);
iam not sure this is safe, it would be better if there are no
pointers.
This would break if the AVQuantizationParamsArray is moved in memory
or cloned and the orginal freed or cloned and the clone changed
with the expextiaiion that the original stays unchanged
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
You can kill me, but you cannot change the truth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190730/347fa077/attachment.sig>
More information about the ffmpeg-devel
mailing list