FEI: libs: Add fei codec objects in codedbufferproxy

MbCode, MV and Distortion buffers (fei codec objects)
can be treated as output of different fei modes based user request.
For eg: MbCode and MV are the output of ENC only. MbCode, MV and Dist
can be dumped as output in ENC_PAK mode for analysis purpose.
So treating them as a part of CodedBufferProxy too.
Here we avoided Qp, MbControl and MvPredictor codec objects since
there is no practical use case of treating them as "output buffers".

Other contributors:
               Zhong, Xiaoxia <xiaoxia.zhong@intel.com>
               xiaominc <xiaomin.chen@intel.com>
               Leilei <leilei.shang@intel.com>
               Li, Jing B <jing.b.li@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785712
https://bugzilla.gnome.org/show_bug.cgi?id=784667
This commit is contained in:
Sreerenj Balachandran 2017-08-09 16:05:13 -07:00 committed by Víctor Manuel Jáquez Leal
parent d5542fa8c0
commit 132eacde79
3 changed files with 156 additions and 0 deletions

View file

@ -54,6 +54,19 @@ coded_buffer_proxy_finalize (GstVaapiCodedBufferProxy * proxy)
/* Notify the user function that the object is now destroyed */
if (proxy->destroy_func)
proxy->destroy_func (proxy->destroy_data);
#if USE_H264_FEI_ENCODER
if (proxy->mbcode)
gst_vaapi_fei_codec_object_replace ((GstVaapiFeiCodecObject **) &
proxy->mbcode, NULL);
if (proxy->mv)
gst_vaapi_fei_codec_object_replace ((GstVaapiFeiCodecObject **) &
proxy->mv, NULL);
if (proxy->dist)
gst_vaapi_fei_codec_object_replace ((GstVaapiFeiCodecObject **) &
proxy->dist, NULL);
#endif
}
static inline const GstVaapiMiniObjectClass *
@ -95,6 +108,11 @@ gst_vaapi_coded_buffer_proxy_new_from_pool (GstVaapiCodedBufferPool * pool)
proxy->user_data_destroy = NULL;
proxy->pool = gst_vaapi_video_pool_ref (pool);
proxy->buffer = gst_vaapi_video_pool_get_object (proxy->pool);
#if USE_H264_FEI_ENCODER
proxy->mv = NULL;
proxy->mbcode = NULL;
proxy->dist = NULL;
#endif
if (!proxy->buffer)
goto error;
gst_vaapi_object_ref (proxy->buffer);
@ -254,3 +272,104 @@ gst_vaapi_coded_buffer_proxy_set_user_data (GstVaapiCodedBufferProxy * proxy,
coded_buffer_proxy_set_user_data (proxy, user_data, destroy_func);
}
#if USE_H264_FEI_ENCODER
/**
* gst_vaapi_coded_buffer_proxy_get_fei_mb_code:
* @proxy: a #GstVaapiCodedBufferProxy
*
* Returns the #GstVaapiEncFeiMbCode stored in the @proxy
*
* Return value: the #GstVaapiEncFeiMbcode, or %NULL if none was
* associated with the surface proxy
*/
GstVaapiEncFeiMbCode *
gst_vaapi_coded_buffer_proxy_get_fei_mbcode (GstVaapiCodedBufferProxy * proxy)
{
g_return_val_if_fail (proxy != NULL, 0);
return proxy->mbcode;
}
/**
* gst_vaapi_coded_buffer_proxy_get_fei_mv:
* @proxy: a #GstVaapiCodedBufferProxy
*
* Returns the #GstVaapiEncFeiMv stored in the @proxy
*
* Return value: the #GstVaapiEncFeiMv, or %NULL if none was
* associated with the surface proxy
*/
GstVaapiEncFeiMv *
gst_vaapi_coded_buffer_proxy_get_fei_mv (GstVaapiCodedBufferProxy * proxy)
{
g_return_val_if_fail (proxy != NULL, 0);
return proxy->mv;
}
/**
* gst_vaapi_coded_buffer_proxy_get_fei_distortion:
* @proxy: a #GstVaapiCodedBufferProxy
*
* Returns the #GstVaapiEncFeiDistortion stored in the @proxy
*
* Return value: the #GstVaapiEncFeiDistortion, or %NULL if none was
* associated with the surface proxy
*/
GstVaapiEncFeiDistortion *
gst_vaapi_coded_buffer_proxy_get_fei_distortion (GstVaapiCodedBufferProxy *
proxy)
{
g_return_val_if_fail (proxy != NULL, 0);
return proxy->dist;
}
/**
* gst_vaapi_coded_buffer_proxy_set_fei_mb_code:
* @proxy: #GstVaapiCodedBufferProxy
* @mbcode: the #GstVaapiEncFeiMbCode to be stored in @proxy
*
* Associates the @mbcode with the @proxy
*/
void
gst_vaapi_coded_buffer_proxy_set_fei_mb_code (GstVaapiCodedBufferProxy * proxy,
GstVaapiEncFeiMbCode * mbcode)
{
g_return_if_fail (proxy != NULL);
gst_vaapi_fei_codec_object_replace ((GstVaapiFeiCodecObject **) &
proxy->mbcode, (GstVaapiFeiCodecObject *) mbcode);
}
/**
* gst_vaapi_coded_buffer_proxy_set_fei_mv:
* @proxy: #GstVaapiCodedBufferProxy
* @mv: the #GstVaapiEncFeiMv to be stored in @proxy
*
* Associates the @mv with the @proxy
*/
void
gst_vaapi_coded_buffer_proxy_set_fei_mv (GstVaapiCodedBufferProxy * proxy,
GstVaapiEncFeiMv * mv)
{
g_return_if_fail (proxy != NULL);
gst_vaapi_fei_codec_object_replace ((GstVaapiFeiCodecObject **) &
proxy->mv, (GstVaapiFeiCodecObject *) mv);
}
/**
* gst_vaapi_coded_buffer_proxy_set_fei_distortion:
* @proxy: #GstVaapiSurfaceProxy
* @dist: the #GstVaapiEncFeiDistortion to be stored in @proxy
*
* Associates the @dist with the @proxy
*/
void
gst_vaapi_coded_buffer_proxy_set_fei_distortion (GstVaapiCodedBufferProxy *
proxy, GstVaapiEncFeiDistortion * dist)
{
g_return_if_fail (proxy != NULL);
gst_vaapi_fei_codec_object_replace ((GstVaapiFeiCodecObject **) &
proxy->dist, (GstVaapiFeiCodecObject *) dist);
}
#endif

View file

@ -26,6 +26,10 @@
#include <gst/vaapi/gstvaapicodedbuffer.h>
#include <gst/vaapi/gstvaapicodedbufferpool.h>
#if USE_H264_FEI_ENCODER
#include <gst/vaapi/gstvaapifei_objects.h>
#endif
G_BEGIN_DECLS
/**
@ -77,6 +81,29 @@ void
gst_vaapi_coded_buffer_proxy_set_user_data (GstVaapiCodedBufferProxy * proxy,
gpointer user_data, GDestroyNotify destroy_func);
#if USE_H264_FEI_ENCODER
GstVaapiEncFeiMbCode *
gst_vaapi_coded_buffer_proxy_get_fei_mbcode (GstVaapiCodedBufferProxy * proxy);
GstVaapiEncFeiMv *
gst_vaapi_coded_buffer_proxy_get_fei_mv (GstVaapiCodedBufferProxy * proxy);
GstVaapiEncFeiDistortion *
gst_vaapi_coded_buffer_proxy_get_fei_distortion (GstVaapiCodedBufferProxy * proxy);
void
gst_vaapi_coded_buffer_proxy_set_fei_mb_code (GstVaapiCodedBufferProxy * proxy,
GstVaapiEncFeiMbCode *mbcode);
void
gst_vaapi_coded_buffer_proxy_set_fei_mv (GstVaapiCodedBufferProxy * proxy,
GstVaapiEncFeiMv *mv);
void
gst_vaapi_coded_buffer_proxy_set_fei_distortion (GstVaapiCodedBufferProxy * proxy,
GstVaapiEncFeiDistortion *dist);
#endif
G_END_DECLS
#endif /* GST_VAAPI_CODED_BUFFER_PROXY_H */

View file

@ -26,6 +26,10 @@
#include "gstvaapicodedbuffer_priv.h"
#include "gstvaapiminiobject.h"
#if USE_H264_FEI_ENCODER
#include <gst/vaapi/gstvaapifei_objects.h>
#endif
G_BEGIN_DECLS
#define GST_VAAPI_CODED_BUFFER_PROXY(proxy) \
@ -42,6 +46,12 @@ struct _GstVaapiCodedBufferProxy
gpointer destroy_data;
GDestroyNotify user_data_destroy;
gpointer user_data;
#if USE_H264_FEI_ENCODER
GstVaapiEncFeiMbCode *mbcode;
GstVaapiEncFeiMv *mv;
GstVaapiEncFeiDistortion *dist;
#endif
};
/**