vmaf: split out into plugin.c, element.c, rename files. simplify buffer copy

This commit is contained in:
Casey Bateman 2021-12-15 15:46:40 -06:00
parent b9451d736d
commit eccceea6ba
7 changed files with 65 additions and 38 deletions

View file

@ -1,5 +1,6 @@
/* VMAF plugin
* Copyright (C) 2015 Casey Bateman <Casey.Bateman@hudl.com>
* Copyright (C) 2021 Hudl
* @author: Casey Bateman <Casey.Bateman@hudl.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -16,8 +17,8 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "vmafconvert.h"
#include "vmafenums.h"
#include "gstvmafconvert.h"
#include "gstvmafenums.h"
enum VmafOutputFormat
vmaf_map_log_fmt (GstVmafLogFormats log_fmt)

View file

@ -1,5 +1,6 @@
/* VMAF plugin
* Copyright (C) 2015 Casey Bateman <Casey.Bateman@hudl.com>
* Copyright (C) 2021 Hudl
* @author: Casey Bateman <Casey.Bateman@hudl.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -16,12 +17,12 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_VMAFMAP_H__
#define __GST_VMAFMAP_H__
#ifndef __GST_VMAFCONVERT_H__
#define __GST_VMAFCONVERT_H__
#include <libvmaf.h>
#include <gst/gst.h>
#include "vmafenums.h"
#include "gstvmafenums.h"
G_BEGIN_DECLS
enum VmafOutputFormat vmaf_map_log_fmt (GstVmafLogFormats log_fmt);
@ -32,4 +33,4 @@ void fill_vmaf_picture_buffer (float *src, VmafPicture * dst, unsigned width, un
void fill_vmaf_picture_buffer_hbd (float *src, VmafPicture * dst, unsigned width, unsigned height, int src_stride, unsigned bpc);
G_END_DECLS
#endif /* __GST_VMAFMAP_H__ */
#endif /* __GST_VMAFCONVERT_H__ */

View file

@ -1,5 +1,6 @@
/* VMAF plugin
* Copyright (C) 2015 Casey Bateman <Casey.Bateman@hudl.com>
* Copyright (C) 2021 Hudl
* @author: Casey Bateman <Casey.Bateman@hudl.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -59,9 +60,9 @@
#include <stdio.h>
#include <libvmaf.h>
#include "vmafplugin.h"
#include "vmafconvert.h"
#include "vmafenums.h"
#include "gstvmafelements.h"
#include "gstvmafconvert.h"
#include "gstvmafenums.h"
GST_DEBUG_CATEGORY_STATIC (gst_vmaf_debug);
#define GST_CAT_DEFAULT gst_vmaf_debug
@ -835,11 +836,8 @@ gst_vmaf_read_and_queue_frames (GstVmaf * self, GstVideoFrame * ref,
g_mutex_lock (&thread_data->check_thread_failure);
if (!thread_data->thread_failure) {
gint i;
gst_buffer_copy_into (outbuf, ref->buffer, GST_BUFFER_COPY_ALL, 0, -1);
result = TRUE;
for (i = 0; i < ref_info.size; i++) {
out_info.data[i] = ref_info.data[i];
}
} else {
vmaf_stream_thread_stop (thread_data->vmaf_thread);
result = FALSE;
@ -1323,17 +1321,3 @@ gst_vmaf_class_init (GstVmafClass * klass)
"Casey Bateman <casey.bateman@hudl.com>");
GST_DEBUG_CATEGORY_INIT (gst_vmaf_debug, "vmaf", 0, "vmaf");
}
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean result =
gst_element_register (plugin, "vmaf", GST_RANK_PRIMARY, GST_TYPE_VMAF);
return result;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
vmaf,
"Netflix VMAF quality metric plugin",
plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -1,5 +1,6 @@
/* VMAF plugin
* Copyright (C) 2015 Casey Bateman <Casey.Bateman@hudl.com>
* Copyright (C) 2021 Hudl
* @author: Casey Bateman <Casey.Bateman@hudl.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -16,14 +17,14 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_VMAF_H__
#define __GST_VMAF_H__
#ifndef __GST_VMAFELEMENT_H__
#define __GST_VMAFELEMENT_H__
#include <libvmaf.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideoaggregator.h>
#include "vmafenums.h"
#include "gstvmafenums.h"
G_BEGIN_DECLS
#define GST_TYPE_VMAF (gst_vmaf_get_type())
@ -101,4 +102,4 @@ struct _GstVmafClass
GType gst_vmaf_get_type (void);
G_END_DECLS
#endif /* __GST_VMAF_H__ */
#endif /* __GST_VMAFELEMENT_H__ */

View file

@ -1,5 +1,6 @@
/* VMAF plugin
* Copyright (C) 2015 Casey Bateman <Casey.Bateman@hudl.com>
* Copyright (C) 2021 Hudl
* @author: Casey Bateman <Casey.Bateman@hudl.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public

View file

@ -0,0 +1,38 @@
/* VMAF plugin
* Copyright (C) 2021 Hudl
* @author: Casey Bateman <Casey.Bateman@hudl.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "gstvmafelements.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean result =
gst_element_register (plugin, "vmaf", GST_RANK_PRIMARY, GST_TYPE_VMAF);
return result;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
vmaf,
"Netflix VMAF quality metric plugin",
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -1,6 +1,7 @@
vmaf_sources = [
'vmafplugin.c',
'vmafconvert.c',
'gstvmafconvert.c',
'gstvmafelement.c',
'gstvmafplugin.c',
]
libvmaf_dep = dependency('libvmaf', required : get_option('vmaf'))