[FFmpeg-devel] [PATCH 2/2] lavu/frame: add QP side data
Michael Niedermayer
michael at niedermayer.cc
Fri Mar 2 03:10:18 EET 2018
On Thu, Mar 01, 2018 at 04:58:22PM +0100, wm4 wrote:
> This adds a way for an API user to transfer QP data and metadata without
> having to keep the reference to AVFrame, and without having to
> explicitly care about QP APIs. It might also provide a way to finally
> remove the deprecated QP related fields. In the end, the QP table should
> be handled in a very similar way to e.g. AV_FRAME_DATA_MOTION_VECTORS.
>
> There are two side data types, because I didn't care about having to
> repack the QP data so the table and the metadata are in a single
> AVBufferRef. Otherwise it would have either required a copy on decoding
> (extra slowdown for something as obscure as the QP data), or would have
> required making intrusive changes to the codecs which support export of
> this data.
>
> The new side data types are added under deprecation guards, because I
> don't intend to change the status of the QP export as being deprecated
> (as it was before this patch too).
> ---
> libavutil/frame.c | 55 +++++++++++++++++++++++++++++++++-----
> libavutil/frame.h | 17 ++++++++++++
> tests/ref/fate/exif-image-embedded | 6 +++++
> tests/ref/fate/exif-image-jpg | 34 +++++++++++++----------
> 4 files changed, 92 insertions(+), 20 deletions(-)
>
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index 3ecd739317..a9e76504eb 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -51,8 +51,16 @@ MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range)
> av_get_channel_layout_nb_channels((frame)->channel_layout))
>
> #if FF_API_FRAME_QP
> +struct qp_properties {
> + int stride;
> + int type;
> +};
> +
> int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int qp_type)
> {
> + struct qp_properties *p;
> + AVFrameSideData *sd;
> +
> FF_DISABLE_DEPRECATION_WARNINGS
> av_buffer_unref(&f->qp_table_buf);
>
> @@ -62,20 +70,53 @@ FF_DISABLE_DEPRECATION_WARNINGS
> f->qscale_type = qp_type;
> FF_ENABLE_DEPRECATION_WARNINGS
>
> + av_frame_remove_side_data(f, AV_FRAME_DATA_QP_TABLE_PROPERTIES);
> + av_frame_remove_side_data(f, AV_FRAME_DATA_QP_TABLE_DATA);
> +
> + if (!frame_new_side_data(f, AV_FRAME_DATA_QP_TABLE_DATA, av_buffer_ref(buf)))
> + return AVERROR(ENOMEM);
> +
This does not build anymore after 6731f60598963da357ff77dafe9e5e903629bde9
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
"Nothing to hide" only works if the folks in power share the values of
you and everyone you know entirely and always will -- Tom Scott
-------------- 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/20180302/3259f561/attachment.sig>
More information about the ffmpeg-devel
mailing list