cog: fixes to make cog work inside -bad

This commit is contained in:
David Schleef 2009-09-18 14:25:49 -07:00
parent 8c856cfb5a
commit f367e5fbde
18 changed files with 285 additions and 163 deletions

View file

@ -675,12 +675,12 @@ AG_GST_CHECK_FEATURE(CELT, [celt], celt, [
dnl *** Cog ***
translit(dnm, m, l) AM_CONDITIONAL(USE_COG, true)
AG_GST_CHECK_FEATURE(COG, [Cog plugin], cog, [
PKG_CHECK_MODULES(ORC, orc-0.4 >= 0.4.2.1, HAVE_COG="yes", [
PKG_CHECK_MODULES(COG, libpng12 orc-0.4 >= 0.4.2.1, HAVE_COG="yes", [
HAVE_COG="no"
AC_MSG_RESULT(no)
])
AC_SUBST(ORC_CFLAGS)
AC_SUBST(ORC_LIBS)
AC_SUBST(COG_CFLAGS)
AC_SUBST(COG_LIBS)
])
dnl *** dc1394 ***

View file

@ -64,6 +64,12 @@ else
CELT_DIR=
endif
if USE_COG
COG_DIR=cog
else
COG_DIR=
endif
if USE_DC1394
DC1394_DIR=dc1394
else
@ -366,6 +372,7 @@ SUBDIRS=\
$(BZ2_DIR) \
$(CDAUDIO_DIR) \
$(CELT_DIR) \
$(COG_DIR) \
$(DC1394_DIR) \
$(DIRAC_DIR) \
$(DIRECTFB_DIR) \
@ -422,6 +429,7 @@ DIST_SUBDIRS = \
bz2 \
cdaudio \
celt \
cog \
dc1394 \
dirac \
directfb \

View file

@ -1,6 +1,8 @@
plugin_LTLIBRARIES = libgstcog.la
libgstcog_la_CFLAGS = \
-DCOG_ENABLE_UNSTABLE_API \
-I$(srcdir)/.. \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_CFLAGS) \
$(COG_CFLAGS)
@ -13,10 +15,12 @@ libgstcog_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(LIBM)
libgstcog_la_LIBTOOLFLAGS = --tag=disable-static
libgstcog_la_SOURCES = \
cog.h \
cogframe.c \
cogframe.h \
cogorc.c \
cogorc.h \
cogutils.h \
cogvirtframe.c \
cogvirtframe.h \
gstcog.c \

10
ext/cog/cog.h Normal file
View file

@ -0,0 +1,10 @@
#ifndef __COG_COG_H__
#define __COG_COG_H__
#include <cog/cogutils.h>
void cog_init (void);
#endif

View file

@ -5,9 +5,10 @@
#endif
#include <cog/cog.h>
#include <cog-video/cogframe.h>
#include <cog-video/cogvirtframe.h>
#include <cog-video/cogorc.h>
#include <cog/cogframe.h>
#include <cog/cogvirtframe.h>
#include <cog/cogorc.h>
#include <gst/gst.h>
#include <stdlib.h>
#include <string.h>
@ -26,7 +27,7 @@ cog_frame_new (void)
{
CogFrame *frame;
frame = cog_malloc0 (sizeof (*frame));
frame = g_malloc0 (sizeof (*frame));
frame->refcount = 1;
return frame;
@ -58,8 +59,8 @@ cog_frame_new_and_alloc_extended (CogMemoryDomain * domain,
int ext_width;
int ext_height;
COG_ASSERT (width > 0);
COG_ASSERT (height > 0);
g_return_val_if_fail (width > 0, NULL);
g_return_val_if_fail (height > 0, NULL);
frame->format = format;
frame->width = width;
@ -71,7 +72,7 @@ cog_frame_new_and_alloc_extended (CogMemoryDomain * domain,
ext_height = height + extension * 2;
if (COG_FRAME_IS_PACKED (format)) {
COG_ASSERT (extension == 0);
g_return_val_if_fail (extension == 0, NULL);
frame->components[0].format = format;
frame->components[0].width = width;
@ -87,7 +88,7 @@ cog_frame_new_and_alloc_extended (CogMemoryDomain * domain,
//frame->regions[0] = cog_memory_domain_alloc (domain,
// frame->components[0].length);
} else {
frame->regions[0] = cog_malloc (frame->components[0].length);
frame->regions[0] = g_malloc (frame->components[0].length);
}
frame->components[0].data = frame->regions[0];
@ -108,7 +109,7 @@ cog_frame_new_and_alloc_extended (CogMemoryDomain * domain,
bytes_pp = 4;
break;
default:
COG_ASSERT (0);
g_return_val_if_reached (NULL);
bytes_pp = 0;
break;
}
@ -159,14 +160,14 @@ cog_frame_new_and_alloc_extended (CogMemoryDomain * domain,
frame->components[1].length + frame->components[2].length);
}
frame->components[0].data = frame->regions[0] +
frame->components[0].stride * extension + bytes_pp * extension;
frame->components[1].data = frame->regions[0] +
frame->components[0].data = COG_OFFSET (frame->regions[0],
frame->components[0].stride * extension + bytes_pp * extension);
frame->components[1].data = COG_OFFSET (frame->regions[0],
frame->components[0].length +
frame->components[1].stride * extension + bytes_pp * extension;
frame->components[2].data = frame->regions[0] +
frame->components[1].stride * extension + bytes_pp * extension);
frame->components[2].data = COG_OFFSET (frame->regions[0],
frame->components[0].length + frame->components[1].length +
frame->components[2].stride * extension + bytes_pp * extension;
frame->components[2].stride * extension + bytes_pp * extension);
return frame;
}
@ -409,7 +410,7 @@ cog_frame_new_from_data_I420 (void *data, int width, int height)
frame->components[1].length =
frame->components[1].stride * frame->components[1].height;
frame->components[1].data =
frame->components[0].data + frame->components[0].length;
COG_OFFSET (frame->components[0].data, frame->components[0].length);
frame->components[1].v_shift = 1;
frame->components[1].h_shift = 1;
@ -420,7 +421,7 @@ cog_frame_new_from_data_I420 (void *data, int width, int height)
frame->components[2].length =
frame->components[2].stride * frame->components[2].height;
frame->components[2].data =
frame->components[1].data + frame->components[1].length;
COG_OFFSET (frame->components[1].data, frame->components[1].length);
frame->components[2].v_shift = 1;
frame->components[2].h_shift = 1;
@ -465,7 +466,7 @@ cog_frame_new_from_data_YV12 (void *data, int width, int height)
frame->components[2].length =
frame->components[2].stride * frame->components[2].height;
frame->components[2].data =
frame->components[0].data + frame->components[0].length;
COG_OFFSET (frame->components[0].data, frame->components[0].length);
frame->components[2].v_shift = 1;
frame->components[2].h_shift = 1;
@ -476,7 +477,7 @@ cog_frame_new_from_data_YV12 (void *data, int width, int height)
frame->components[1].length =
frame->components[1].stride * frame->components[1].height;
frame->components[1].data =
frame->components[2].data + frame->components[2].length;
COG_OFFSET (frame->components[2].data, frame->components[2].length);
frame->components[1].v_shift = 1;
frame->components[1].h_shift = 1;
@ -521,7 +522,7 @@ cog_frame_new_from_data_Y42B (void *data, int width, int height)
frame->components[1].length =
frame->components[1].stride * frame->components[1].height;
frame->components[1].data =
frame->components[0].data + frame->components[0].length;
COG_OFFSET (frame->components[0].data, frame->components[0].length);
frame->components[1].v_shift = 0;
frame->components[1].h_shift = 1;
@ -532,7 +533,7 @@ cog_frame_new_from_data_Y42B (void *data, int width, int height)
frame->components[2].length =
frame->components[2].stride * frame->components[2].height;
frame->components[2].data =
frame->components[1].data + frame->components[1].length;
COG_OFFSET (frame->components[1].data, frame->components[1].length);
frame->components[2].v_shift = 0;
frame->components[2].h_shift = 1;
@ -577,7 +578,7 @@ cog_frame_new_from_data_Y444 (void *data, int width, int height)
frame->components[1].length =
frame->components[1].stride * frame->components[1].height;
frame->components[1].data =
frame->components[0].data + frame->components[0].length;
COG_OFFSET (frame->components[0].data, frame->components[0].length);
frame->components[1].v_shift = 0;
frame->components[1].h_shift = 0;
@ -588,7 +589,7 @@ cog_frame_new_from_data_Y444 (void *data, int width, int height)
frame->components[2].length =
frame->components[2].stride * frame->components[2].height;
frame->components[2].data =
frame->components[1].data + frame->components[1].length;
COG_OFFSET (frame->components[1].data, frame->components[1].length);
frame->components[2].v_shift = 0;
frame->components[2].h_shift = 0;
@ -776,7 +777,7 @@ cog_frame_unref (CogFrame * frame)
{
int i;
COG_ASSERT (frame->refcount > 0);
g_return_if_fail (frame->refcount > 0);
frame->refcount--;
if (frame->refcount == 0) {
@ -806,10 +807,10 @@ cog_frame_unref (CogFrame * frame)
cog_frame_unref (frame->virt_frame2);
}
if (frame->virt_priv) {
cog_free (frame->virt_priv);
g_free (frame->virt_priv);
}
cog_free (frame);
g_free (frame);
}
}
@ -844,8 +845,8 @@ cog_frame_convert (CogFrame * dest, CogFrame * src)
CogFrame *frame;
CogFrameFormat dest_format;
COG_ASSERT (dest != NULL);
COG_ASSERT (src != NULL);
g_return_if_fail (dest != NULL);
g_return_if_fail (src != NULL);
switch (dest->format) {
case COG_FRAME_FORMAT_YUYV:
@ -863,52 +864,52 @@ cog_frame_convert (CogFrame * dest, CogFrame * src)
cog_frame_ref (src);
frame = cog_virt_frame_new_unpack (src);
COG_DEBUG ("unpack %p", frame);
GST_DEBUG ("unpack %p", frame);
if (COG_FRAME_FORMAT_DEPTH (dest_format) !=
COG_FRAME_FORMAT_DEPTH (frame->format)) {
if (COG_FRAME_FORMAT_DEPTH (dest_format) == COG_FRAME_FORMAT_DEPTH_U8) {
frame = cog_virt_frame_new_convert_u8 (frame);
COG_DEBUG ("convert_u8 %p", frame);
GST_DEBUG ("convert_u8 %p", frame);
} else if (COG_FRAME_FORMAT_DEPTH (dest_format) ==
COG_FRAME_FORMAT_DEPTH_S16) {
frame = cog_virt_frame_new_convert_s16 (frame);
COG_DEBUG ("convert_s16 %p", frame);
GST_DEBUG ("convert_s16 %p", frame);
}
}
if ((dest_format & 3) != (frame->format & 3)) {
frame = cog_virt_frame_new_subsample (frame, dest_format);
COG_DEBUG ("subsample %p", frame);
GST_DEBUG ("subsample %p", frame);
}
switch (dest->format) {
case COG_FRAME_FORMAT_YUYV:
frame = cog_virt_frame_new_pack_YUY2 (frame);
COG_DEBUG ("pack_YUY2 %p", frame);
GST_DEBUG ("pack_YUY2 %p", frame);
break;
case COG_FRAME_FORMAT_UYVY:
frame = cog_virt_frame_new_pack_UYVY (frame);
COG_DEBUG ("pack_UYVY %p", frame);
GST_DEBUG ("pack_UYVY %p", frame);
break;
case COG_FRAME_FORMAT_AYUV:
frame = cog_virt_frame_new_pack_AYUV (frame);
COG_DEBUG ("pack_AYUV %p", frame);
GST_DEBUG ("pack_AYUV %p", frame);
break;
default:
break;
}
if (dest->width < frame->width || dest->height < frame->height) {
COG_DEBUG ("crop %d %d to %d %d",
GST_DEBUG ("crop %d %d to %d %d",
frame->width, frame->height, dest->width, dest->height);
frame = cog_virt_frame_new_crop (frame, dest->width, dest->height);
COG_DEBUG ("crop %p", frame);
GST_DEBUG ("crop %p", frame);
}
if (dest->width > src->width || dest->height > src->height) {
frame = cog_virt_frame_new_edgeextend (frame, dest->width, dest->height);
COG_DEBUG ("edgeextend %p", frame);
GST_DEBUG ("edgeextend %p", frame);
}
cog_virt_frame_render (frame, dest);
@ -949,7 +950,7 @@ cog_frame_md5 (CogFrame * frame, uint32_t * state)
}
}
COG_DEBUG
GST_DEBUG
("md5 %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
state[0] & 0xff, (state[0] >> 8) & 0xff, (state[0] >> 16) & 0xff,
(state[0] >> 24) & 0xff, state[1] & 0xff, (state[1] >> 8) & 0xff,
@ -965,7 +966,7 @@ cog_frame_split_fields (CogFrame * dest1, CogFrame * dest2, CogFrame * src)
{
CogFrame src_tmp;
COG_ASSERT ((src->height & 1) == 0);
g_return_if_fail ((src->height & 1) == 0);
memcpy (&src_tmp, src, sizeof (src_tmp));
@ -989,7 +990,7 @@ cog_frame_get_subdata (CogFrame * frame, CogFrameData * fd,
{
CogFrameData *comp = frame->components + component;
COG_ASSERT (COG_FRAME_FORMAT_DEPTH (comp->format) ==
g_return_if_fail (COG_FRAME_FORMAT_DEPTH (comp->format) ==
COG_FRAME_FORMAT_DEPTH_U8);
fd->format = comp->format;

108
ext/cog/cogutils.h Normal file
View file

@ -0,0 +1,108 @@
#ifndef __COG_UTILS_H__
#define __COG_UTILS_H__
#if defined(_MSC_VER)
#ifndef COG_NO_STDINT_TYPEDEFS
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
#endif
#else
#include <stdint.h>
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
typedef void CogMemoryDomain;
typedef unsigned int cog_bool;
#ifdef COG_ENABLE_UNSTABLE_API
#define COG_PICTURE_NUMBER_INVALID (-1)
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#define DIVIDE_ROUND_UP(a,b) (((a) + (b) - 1)/(b))
#ifndef MIN
#define MIN(a,b) ((a)<(b) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a,b) ((a)>(b) ? (a) : (b))
#endif
#ifndef CLAMP
#define CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))
#endif
#define NEED_CLAMP(x,y,a,b) ((x) < (a) || (y) > (b))
#define ROUND_UP_SHIFT(x,y) (((x) + (1<<(y)) - 1)>>(y))
#define ROUND_UP_POW2(x,y) (((x) + (1<<(y)) - 1)&((~0)<<(y)))
#define ROUND_UP_2(x) ROUND_UP_POW2(x,1)
#define ROUND_UP_4(x) ROUND_UP_POW2(x,2)
#define ROUND_UP_8(x) ROUND_UP_POW2(x,3)
#define ROUND_UP_64(x) ROUND_UP_POW2(x,6)
#define OFFSET(ptr,offset) ((void *)(((uint8_t *)(ptr)) + (offset)))
#define ROUND_SHIFT(x,y) (((x) + (1<<((y)-1)))>>(y))
#define cog_divide(a,b) (((a)<0)?(((a) - (b) + 1)/(b)):((a)/(b)))
#endif
#define COG_OFFSET(ptr,offset) ((void *)(((uint8_t *)(ptr)) + (offset)))
#define COG_GET(ptr, offset, type) (*(type *)((uint8_t *)(ptr) + (offset)) )
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
#define COG_GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
#else
#define COG_GNUC_PREREQ(maj, min) 0
#endif
#if COG_GNUC_PREREQ(3,3) && defined(__ELF__)
#define COG_INTERNAL __attribute__ ((visibility ("internal")))
#else
#define COG_INTERNAL
#endif
#ifdef __cplusplus
#define COG_BEGIN_DECLS extern "C" {
#define COG_END_DECLS }
#else
#define COG_BEGIN_DECLS
#define COG_END_DECLS
#endif
COG_BEGIN_DECLS
void * cog_malloc (int size);
void * cog_malloc0 (int size);
void * cog_realloc (void *ptr, int size);
void cog_free (void *ptr);
int cog_utils_multiplier_to_quant_index (double x);
int cog_dequantise (int q, int quant_factor, int quant_offset);
int cog_quantise (int value, int quant_factor, int quant_offset);
void cog_quantise_s16 (int16_t *dest, int16_t *src, int quant_factor,
int quant_offset, int n);
void cog_quantise_s16_table (int16_t *dest, int16_t *src, int quant_index,
cog_bool is_intra, int n);
void cog_dequantise_s16 (int16_t *dest, int16_t *src, int quant_factor,
int quant_offset, int n);
void cog_dequantise_s16_table (int16_t *dest, int16_t *src, int quant_index,
cog_bool is_intra, int n);
double cog_utils_probability_to_entropy (double x);
double cog_utils_entropy (double a, double total);
void cog_utils_reduce_fraction (int *n, int *d);
double cog_utils_get_time (void);
COG_END_DECLS
#endif

View file

@ -5,12 +5,13 @@
#define COG_ENABLE_UNSTABLE_API 1
#include <cog-video/cogvirtframe.h>
#include <cog-video/cogorc.h>
#include <cog/cogvirtframe.h>
#include <cog/cogorc.h>
#include <cog/cog.h>
#include <string.h>
#include <math.h>
#include <orc/orc.h>
#include <gst/gst.h>
CogFrame *
@ -69,7 +70,7 @@ cog_frame_new_virtual (CogMemoryDomain * domain, CogFrameFormat format,
bytes_pp = 4;
break;
default:
COG_ASSERT (0);
g_return_val_if_reached (NULL);
bytes_pp = 0;
break;
}
@ -128,8 +129,8 @@ cog_virt_frame_get_line (CogFrame * frame, int component, int i)
int min;
int min_j;
//COG_ASSERT(i >= 0);
//COG_ASSERT(i < comp->height);
g_return_val_if_fail (i >= 0, NULL);
g_return_val_if_fail (i < comp->height, NULL);
if (!frame->is_virtual) {
return COG_FRAME_DATA_GET_LINE (&frame->components[component], i);
@ -179,7 +180,7 @@ copy (CogFrame * frame, void *_dest, int component, int i)
orc_memcpy (dest, src, frame->components[component].width * 2);
break;
default:
COG_ASSERT (0);
g_return_if_reached ();
break;
}
}
@ -189,8 +190,8 @@ cog_virt_frame_render (CogFrame * frame, CogFrame * dest)
{
int i, k;
COG_ASSERT (frame->width == dest->width);
COG_ASSERT (frame->height >= dest->height);
g_return_if_fail (frame->width == dest->width);
g_return_if_fail (frame->height >= dest->height);
if (frame->is_virtual) {
for (k = 0; k < 3; k++) {
@ -329,8 +330,7 @@ cog_virt_frame_new_horiz_downsample (CogFrame * vf, int n_taps)
virt_frame->render_line = cog_virt_frame_render_downsample_horiz_halfsite;
break;
default:
COG_ASSERT (0);
return NULL;
g_return_val_if_reached (NULL);
}
return virt_frame;
@ -469,7 +469,7 @@ cog_virt_frame_render_downsample_vert_halfsite (CogFrame * frame,
}
break;
default:
COG_ASSERT (0);
g_return_if_reached ();
break;
}
}
@ -1334,8 +1334,7 @@ cog_virt_frame_new_subsample (CogFrame * vf, CogFrameFormat format)
format == COG_FRAME_FORMAT_U8_444) {
render_line = convert_422_444;
} else {
COG_ASSERT (0);
return NULL;
g_return_val_if_reached (NULL);
}
virt_frame = cog_frame_new_virtual (NULL, format, vf->width, vf->height);
virt_frame->virt_frame1 = vf;
@ -1367,7 +1366,7 @@ cog_virt_frame_new_convert_u8 (CogFrame * vf)
virt_frame = cog_frame_new_virtual (NULL, format, vf->width, vf->height);
virt_frame->virt_frame1 = vf;
virt_frame->render_line = convert_u8_s16;
virt_frame->virt_priv = cog_malloc (sizeof (int16_t) * vf->width);
virt_frame->virt_priv = g_malloc (sizeof (int16_t) * vf->width);
return virt_frame;
}
@ -1426,8 +1425,8 @@ cog_virt_frame_new_crop (CogFrame * vf, int width, int height)
if (width == vf->width && height == vf->height)
return vf;
COG_ASSERT (width <= vf->width);
COG_ASSERT (height <= vf->height);
g_return_val_if_fail (width <= vf->width, NULL);
g_return_val_if_fail (height <= vf->height, NULL);
virt_frame = cog_frame_new_virtual (NULL, vf->format, width, height);
virt_frame->virt_frame1 = vf;
@ -1439,7 +1438,7 @@ cog_virt_frame_new_crop (CogFrame * vf, int width, int height)
virt_frame->render_line = crop_s16;
break;
default:
COG_ASSERT (0);
g_return_val_if_reached (NULL);
break;
}
@ -1487,8 +1486,8 @@ cog_virt_frame_new_edgeextend (CogFrame * vf, int width, int height)
if (width == vf->width && height == vf->height)
return vf;
COG_ASSERT (width >= vf->width);
COG_ASSERT (height >= vf->height);
g_return_val_if_fail (width >= vf->width, NULL);
g_return_val_if_fail (height >= vf->height, NULL);
virt_frame = cog_frame_new_virtual (NULL, vf->format, width, height);
virt_frame->virt_frame1 = vf;
@ -1500,7 +1499,7 @@ cog_virt_frame_new_edgeextend (CogFrame * vf, int width, int height)
virt_frame->render_line = edge_extend_s16;
break;
default:
COG_ASSERT (0);
g_return_val_if_reached (NULL);
break;
}

View file

@ -3,7 +3,7 @@
#define __COG_VIRT_FRAME_H__
#include <cog/cogutils.h>
#include <cog-video/cogframe.h>
#include <cog/cogframe.h>
COG_BEGIN_DECLS

View file

@ -23,36 +23,27 @@
#include <string.h>
#include <gst/gst.h>
#include <cog/cog.h>
#include <orc/orc.h>
#include "gstjpegdec.h"
//GType gst_dither_get_type (void);
GType gst_deblock_get_type (void);
GType gst_cogdownsample_get_type (void);
GType gst_motion_detect_get_type (void);
GType gst_cogcolorspace_get_type (void);
GType gst_cog_scale_get_type (void);
GType gst_colorconvert_get_type (void);
GType gst_logoinsert_get_type (void);
GType gst_mse_get_type (void);
#if 0
GType gst_decimate_get_type (void);
GType gst_motion_detect_get_type (void);
#endif
static gboolean
plugin_init (GstPlugin * plugin)
{
cog_init ();
orc_init ();
gst_element_register (plugin, "cogjpegdec", GST_RANK_PRIMARY,
GST_TYPE_JPEG_DEC);
//gst_element_register (plugin, "dither", GST_RANK_NONE,
// gst_dither_get_type());
gst_element_register (plugin, "deblock", GST_RANK_NONE,
gst_deblock_get_type ());
gst_element_register (plugin, "cogdownsample", GST_RANK_NONE,
gst_cogdownsample_get_type ());
gst_element_register (plugin, "motiondetect", GST_RANK_NONE,
gst_motion_detect_get_type ());
gst_element_register (plugin, "cogcolorspace", GST_RANK_NONE,
gst_cogcolorspace_get_type ());
gst_element_register (plugin, "cogscale", GST_RANK_NONE,
@ -62,8 +53,14 @@ plugin_init (GstPlugin * plugin)
gst_element_register (plugin, "coglogoinsert", GST_RANK_NONE,
gst_logoinsert_get_type ());
gst_element_register (plugin, "cogmse", GST_RANK_NONE, gst_mse_get_type ());
#if 0
gst_element_register (plugin, "cogdecimate", GST_RANK_NONE,
gst_decimate_get_type ());
gst_element_register (plugin, "motiondetect", GST_RANK_NONE,
gst_motion_detect_get_type ());
gst_element_register (plugin, "deblock", GST_RANK_NONE,
gst_deblock_get_type ());
#endif
return TRUE;
}

View file

@ -35,7 +35,7 @@
#include <string.h>
#include <cog/cog.h>
#include <math.h>
#include <cog-video/cogvirtframe.h>
#include <cog/cogvirtframe.h>
#include "gstcogutils.h"
#define GST_TYPE_COGCOLORSPACE \

View file

@ -35,7 +35,7 @@
#include <string.h>
#include <cog/cog.h>
#include <math.h>
#include <cog-video/cogvirtframe.h>
#include <cog/cogvirtframe.h>
#define GST_TYPE_COGDOWNSAMPLE \
(gst_cogdownsample_get_type())

View file

@ -25,8 +25,6 @@
* $Id: make_filter,v 1.8 2004/04/19 22:51:57 ds Exp $
*/
#define SCHRO_ENABLE_UNSTABLE_API
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@ -34,50 +32,48 @@
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
#include <gst/video/video.h>
#include <cog/cogframe.h>
#include <string.h>
#include <schroedinger/schro.h>
#include <schroedinger/schrotables.h>
#include <liboil/liboil.h>
#include <math.h>
#define GST_TYPE_SCHROFILTER \
(gst_schrofilter_get_type())
#define GST_SCHROFILTER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SCHROFILTER,GstSchrofilter))
#define GST_SCHROFILTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SCHROFILTER,GstSchrofilterClass))
#define GST_IS_SCHROFILTER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SCHROFILTER))
#define GST_IS_SCHROFILTER_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SCHROFILTER))
#define GST_TYPE_COG_FILTER \
(gst_cog_filter_get_type())
#define GST_COG_FILTER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_COG_FILTER,GstCogFilter))
#define GST_COG_FILTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_COG_FILTER,GstCogFilterClass))
#define GST_IS_COG_FILTER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_COG_FILTER))
#define GST_IS_COG_FILTER_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_COG_FILTER))
typedef struct _GstSchrofilter GstSchrofilter;
typedef struct _GstSchrofilterClass GstSchrofilterClass;
typedef struct _GstCogFilter GstCogFilter;
typedef struct _GstCogFilterClass GstCogFilterClass;
struct _GstSchrofilter
struct _GstCogFilter
{
GstBaseTransform base_transform;
int wavelet_type;
int level;
SchroVideoFormat format;
GstVideoFormat format;
SchroFrame *tmp_frame;
CogFrame *tmp_frame;
int16_t *tmpbuf;
int frame_number;
};
struct _GstSchrofilterClass
struct _GstCogFilterClass
{
GstBaseTransformClass parent_class;
};
/* GstSchrofilter signals and args */
/* GstCogFilter signals and args */
enum
{
/* FILL ME */
@ -92,28 +88,28 @@ enum
/* FILL ME */
};
GType gst_schrofilter_get_type (void);
GType gst_cog_filter_get_type (void);
static void gst_schrofilter_base_init (gpointer g_class);
static void gst_schrofilter_class_init (gpointer g_class, gpointer class_data);
static void gst_schrofilter_init (GTypeInstance * instance, gpointer g_class);
static void gst_cog_filter_base_init (gpointer g_class);
static void gst_cog_filter_class_init (gpointer g_class, gpointer class_data);
static void gst_cog_filter_init (GTypeInstance * instance, gpointer g_class);
static void gst_schrofilter_set_property (GObject * object, guint prop_id,
static void gst_cog_filter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_schrofilter_get_property (GObject * object, guint prop_id,
static void gst_cog_filter_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_schrofilter_transform_ip (GstBaseTransform *
static GstFlowReturn gst_cog_filter_transform_ip (GstBaseTransform *
base_transform, GstBuffer * buf);
static GstStaticPadTemplate gst_schrofilter_sink_template =
static GstStaticPadTemplate gst_cog_filter_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
);
static GstStaticPadTemplate gst_schrofilter_src_template =
static GstStaticPadTemplate gst_cog_filter_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
@ -121,62 +117,62 @@ GST_STATIC_PAD_TEMPLATE ("src",
);
GType
gst_schrofilter_get_type (void)
gst_cog_filter_get_type (void)
{
static GType compress_type = 0;
if (!compress_type) {
static const GTypeInfo compress_info = {
sizeof (GstSchrofilterClass),
gst_schrofilter_base_init,
sizeof (GstCogFilterClass),
gst_cog_filter_base_init,
NULL,
gst_schrofilter_class_init,
gst_cog_filter_class_init,
NULL,
NULL,
sizeof (GstSchrofilter),
sizeof (GstCogFilter),
0,
gst_schrofilter_init,
gst_cog_filter_init,
};
compress_type = g_type_register_static (GST_TYPE_BASE_TRANSFORM,
"GstSchrofilter", &compress_info, 0);
"GstCogFilter", &compress_info, 0);
}
return compress_type;
}
static void
gst_schrofilter_base_init (gpointer g_class)
gst_cog_filter_base_init (gpointer g_class)
{
static GstElementDetails compress_details =
GST_ELEMENT_DETAILS ("Schroedinger Video Filters",
GST_ELEMENT_DETAILS ("Cog Video Filter",
"Filter/Effect/Video",
"Applies a Schroedinger compression pre-filter to video",
"Applies a cog pre-filter to video",
"David Schleef <ds@schleef.org>");
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
//GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_schrofilter_src_template));
gst_static_pad_template_get (&gst_cog_filter_src_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_schrofilter_sink_template));
gst_static_pad_template_get (&gst_cog_filter_sink_template));
gst_element_class_set_details (element_class, &compress_details);
}
static void
gst_schrofilter_class_init (gpointer g_class, gpointer class_data)
gst_cog_filter_class_init (gpointer g_class, gpointer class_data)
{
GObjectClass *gobject_class;
GstBaseTransformClass *base_transform_class;
GstSchrofilterClass *filter_class;
GstCogFilterClass *filter_class;
gobject_class = G_OBJECT_CLASS (g_class);
base_transform_class = GST_BASE_TRANSFORM_CLASS (g_class);
filter_class = GST_SCHROFILTER_CLASS (g_class);
filter_class = GST_COG_FILTER_CLASS (g_class);
gobject_class->set_property = gst_schrofilter_set_property;
gobject_class->get_property = gst_schrofilter_get_property;
gobject_class->set_property = gst_cog_filter_set_property;
gobject_class->get_property = gst_cog_filter_get_property;
g_object_class_install_property (gobject_class, ARG_WAVELET_TYPE,
g_param_spec_int ("wavelet-type", "wavelet type", "wavelet type",
@ -185,28 +181,28 @@ gst_schrofilter_class_init (gpointer g_class, gpointer class_data)
g_param_spec_int ("level", "level", "level",
0, 100, 0, G_PARAM_READWRITE));
base_transform_class->transform_ip = gst_schrofilter_transform_ip;
base_transform_class->transform_ip = gst_cog_filter_transform_ip;
}
static void
gst_schrofilter_init (GTypeInstance * instance, gpointer g_class)
gst_cog_filter_init (GTypeInstance * instance, gpointer g_class)
{
//GstSchrofilter *compress = GST_SCHROFILTER (instance);
//GstCogFilter *compress = GST_COG_FILTER (instance);
//GstBaseTransform *btrans = GST_BASE_TRANSFORM (instance);
GST_DEBUG ("gst_schrofilter_init");
GST_DEBUG ("gst_cog_filter_init");
}
static void
gst_schrofilter_set_property (GObject * object, guint prop_id,
gst_cog_filter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstSchrofilter *src;
GstCogFilter *src;
g_return_if_fail (GST_IS_SCHROFILTER (object));
src = GST_SCHROFILTER (object);
g_return_if_fail (GST_IS_COG_FILTER (object));
src = GST_COG_FILTER (object);
GST_DEBUG ("gst_schrofilter_set_property");
GST_DEBUG ("gst_cog_filter_set_property");
switch (prop_id) {
case ARG_WAVELET_TYPE:
src->wavelet_type = g_value_get_int (value);
@ -220,13 +216,13 @@ gst_schrofilter_set_property (GObject * object, guint prop_id,
}
static void
gst_schrofilter_get_property (GObject * object, guint prop_id, GValue * value,
gst_cog_filter_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstSchrofilter *src;
GstCogFilter *src;
g_return_if_fail (GST_IS_SCHROFILTER (object));
src = GST_SCHROFILTER (object);
g_return_if_fail (GST_IS_COG_FILTER (object));
src = GST_COG_FILTER (object);
switch (prop_id) {
case ARG_WAVELET_TYPE:
@ -242,24 +238,22 @@ gst_schrofilter_get_property (GObject * object, guint prop_id, GValue * value,
}
static GstFlowReturn
gst_schrofilter_transform_ip (GstBaseTransform * base_transform,
GstBuffer * buf)
gst_cog_filter_transform_ip (GstBaseTransform * base_transform, GstBuffer * buf)
{
GstSchrofilter *compress;
SchroFrame *frame;
GstCogFilter *compress;
CogFrame *frame;
int width, height;
g_return_val_if_fail (GST_IS_SCHROFILTER (base_transform), GST_FLOW_ERROR);
compress = GST_SCHROFILTER (base_transform);
g_return_val_if_fail (GST_IS_COG_FILTER (base_transform), GST_FLOW_ERROR);
compress = GST_COG_FILTER (base_transform);
gst_structure_get_int (gst_caps_get_structure (buf->caps, 0),
"width", &width);
gst_structure_get_int (gst_caps_get_structure (buf->caps, 0),
"height", &height);
frame = schro_frame_new_from_data_I420 (GST_BUFFER_DATA (buf), width, height);
schro_frame_filter_lowpass2 (frame, 5.0);
//schro_frame_filter_wavelet (frame);
frame = cog_frame_new_from_data_I420 (GST_BUFFER_DATA (buf), width, height);
//cog_frame_filter_lowpass2 (frame, 5.0);
return GST_FLOW_OK;
}

View file

@ -25,7 +25,7 @@
#include <gst/gst.h>
#include <gst/video/video.h>
#include <string.h>
#include <cog-video/cogframe.h>
#include <cog/cogframe.h>
#include <orc/orc.h>
#include <math.h>
@ -171,19 +171,20 @@ gst_mse_init (GstMSE * filter, GstMSEClass * klass)
{
gst_element_create_all_pads (GST_ELEMENT (filter));
filter->srcpad = gst_element_get_pad (GST_ELEMENT (filter), "src");
filter->srcpad = gst_element_get_static_pad (GST_ELEMENT (filter), "src");
//gst_pad_set_link_function (filter->srcpad, gst_mse_link_src);
gst_pad_set_getcaps_function (filter->srcpad, gst_mse_getcaps);
filter->sinkpad_ref = gst_element_get_pad (GST_ELEMENT (filter), "sink_ref");
filter->sinkpad_ref =
gst_element_get_static_pad (GST_ELEMENT (filter), "sink_ref");
gst_pad_set_chain_function (filter->sinkpad_ref, gst_mse_chain_ref);
gst_pad_set_event_function (filter->sinkpad_ref, gst_mse_sink_event);
gst_pad_set_getcaps_function (filter->sinkpad_ref, gst_mse_getcaps);
filter->sinkpad_test =
gst_element_get_pad (GST_ELEMENT (filter), "sink_test");
gst_element_get_static_pad (GST_ELEMENT (filter), "sink_test");
gst_pad_set_chain_function (filter->sinkpad_test, gst_mse_chain_test);
gst_pad_set_event_function (filter->sinkpad_test, gst_mse_sink_event);
@ -499,8 +500,8 @@ cog_frame_component_squared_error (CogFrameData * a, CogFrameData * b)
int j;
double sum;
COG_ASSERT (a->width == b->width);
COG_ASSERT (a->height == b->height);
g_return_val_if_fail (a->width == b->width, 0.0);
g_return_val_if_fail (a->height == b->height, 0.0);
sum = 0;
for (j = 0; j < a->height; j++) {

View file

@ -66,7 +66,7 @@
#include <gst/video/video.h>
#include <gst/base/gstbasetransform.h>
#include <cog/cog.h>
#include <cog-video/cogvirtframe.h>
#include <cog/cogvirtframe.h>
#include "gstcogutils.h"
GST_DEBUG_CATEGORY_STATIC (cog_scale_debug);

View file

@ -24,7 +24,7 @@
#include <gst/gst.h>
#include <gst/video/video.h>
#include <cog/cog.h>
#include <cog-video/cogvirtframe.h>
#include <cog/cogvirtframe.h>
#include <math.h>
#include <string.h>

View file

@ -23,7 +23,7 @@
#include <gst/gst.h>
#include <gst/video/video.h>
#include <cog/cog.h>
#include <cog-video/cogframe.h>
#include <cog/cogframe.h>
CogFrame *
gst_cog_buffer_wrap (GstBuffer *buf, GstVideoFormat format, int width,

View file

@ -26,7 +26,7 @@
#include <gst/video/video.h>
#include <string.h>
#include <cog/cog.h>
#include <cog-video/cogvirtframe.h>
#include <cog/cogvirtframe.h>
#include <math.h>
#include "gstcogutils.h"
@ -293,7 +293,7 @@ cog_virt_frame_new_color_transform (CogFrame * frame)
{
CogFrame *virt_frame;
COG_ASSERT (frame->format == COG_FRAME_FORMAT_U8_444);
g_return_val_if_fail (frame->format == COG_FRAME_FORMAT_U8_444, NULL);
virt_frame = cog_frame_new_virtual (NULL, COG_FRAME_FORMAT_U8_444,
frame->width, frame->height);

View file

@ -26,7 +26,7 @@
#include <gst/video/video.h>
#include <string.h>
#include <cog/cog.h>
#include <cog-video/cogvirtframe.h>
#include <cog/cogvirtframe.h>
#include <math.h>
#include <png.h>
#include "gstcogutils.h"