mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
cog: autogenerate code, colorspace improvements
This commit is contained in:
parent
bc25896579
commit
e4a2eb1d6f
8 changed files with 411 additions and 2867 deletions
|
@ -681,6 +681,11 @@ AG_GST_CHECK_FEATURE(COG, [Cog plugin], cog, [
|
|||
])
|
||||
AC_SUBST(COG_CFLAGS)
|
||||
AC_SUBST(COG_LIBS)
|
||||
ORCC=`$PKG_CONFIG --variable=orcc orc-0.4`
|
||||
if test "x$ORCC" = x ; then
|
||||
ORCC=orcc
|
||||
fi
|
||||
AC_SUBST(ORCC)
|
||||
])
|
||||
|
||||
dnl *** dc1394 ***
|
||||
|
|
|
@ -18,8 +18,6 @@ libgstcog_la_SOURCES = \
|
|||
cog.h \
|
||||
cogframe.c \
|
||||
cogframe.h \
|
||||
cogorc.c \
|
||||
cogorc.h \
|
||||
cogutils.h \
|
||||
cogvirtframe.c \
|
||||
cogvirtframe.h \
|
||||
|
@ -34,3 +32,14 @@ libgstcog_la_SOURCES = \
|
|||
gstcolorconvert.c \
|
||||
gstlogoinsert.c
|
||||
|
||||
nodist_libgstcog_la_SOURCES = cogorc.c cogorc.h
|
||||
CLEANFILES = cogorc.c cogorc.h
|
||||
|
||||
EXTRA_DIST=cog.orc
|
||||
|
||||
cogorc.c: cog.orc
|
||||
$(ORCC) --implementation -o cogorc.c cog.orc
|
||||
|
||||
cogorc.h: cog.orc
|
||||
$(ORCC) --header -o cogorc.h cog.orc
|
||||
|
||||
|
|
376
ext/cog/cog.orc
Normal file
376
ext/cog/cog.orc
Normal file
|
@ -0,0 +1,376 @@
|
|||
|
||||
.function cogorc_downsample_horiz_cosite_1tap
|
||||
.dest 1 d1
|
||||
.source 2 s1
|
||||
|
||||
select0wb d1, s1
|
||||
|
||||
|
||||
.function cogorc_downsample_horiz_cosite_3tap
|
||||
.dest 1 d1
|
||||
.source 2 s1
|
||||
.source 2 s2
|
||||
.temp 1 t1
|
||||
.temp 1 t2
|
||||
.temp 1 t3
|
||||
.temp 2 t4
|
||||
.temp 2 t5
|
||||
.temp 2 t6
|
||||
|
||||
copyw t4, s1
|
||||
select0wb t1, t4
|
||||
select1wb t2, t4
|
||||
select0wb t3, s2
|
||||
convubw t4, t1
|
||||
convubw t5, t2
|
||||
convubw t6, t3
|
||||
mullw t5, t5, 2
|
||||
addw t4, t4, t6
|
||||
addw t4, t4, t5
|
||||
addw t4, t4, 2
|
||||
shrsw t4, t4, 2
|
||||
convsuswb d1, t4
|
||||
|
||||
|
||||
.function cogorc_downsample_vert_halfsite_2tap
|
||||
.dest 1 d1
|
||||
.source 1 s1
|
||||
.source 1 s2
|
||||
|
||||
avgub d1, s1, s2
|
||||
|
||||
|
||||
.function cogorc_downsample_vert_cosite_3tap
|
||||
.dest 1 d1
|
||||
.source 1 s1
|
||||
.source 1 s2
|
||||
.source 1 s3
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
.temp 2 t3
|
||||
|
||||
convubw t1, s1
|
||||
convubw t2, s2
|
||||
convubw t3, s3
|
||||
mullw t2, t2, 2
|
||||
addw t1, t1, t3
|
||||
addw t1, t1, t2
|
||||
addw t1, t1, 2
|
||||
shrsw t1, t1, 2
|
||||
convsuswb d1, t1
|
||||
|
||||
|
||||
|
||||
.function cogorc_downsample_vert_halfsite_4tap
|
||||
.dest 1 d1
|
||||
.source 1 s1
|
||||
.source 1 s2
|
||||
.source 1 s3
|
||||
.source 1 s4
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
.temp 2 t3
|
||||
.temp 2 t4
|
||||
|
||||
convubw t1, s1
|
||||
convubw t2, s2
|
||||
convubw t3, s3
|
||||
convubw t4, s4
|
||||
addw t2, t2, t3
|
||||
mullw t2, t2, 26
|
||||
addw t1, t1, t4
|
||||
mullw t1, t1, 6
|
||||
addw t2, t2, t1
|
||||
addw t2, t2, 32
|
||||
shrsw t2, t2, 6
|
||||
convsuswb d1, t2
|
||||
|
||||
|
||||
.function cogorc_upsample_horiz_cosite_1tap
|
||||
.dest 2 d1 uint8_t
|
||||
.source 1 s1
|
||||
.temp 1 t1
|
||||
|
||||
copyb t1, s1
|
||||
mergebw d1, t1, t1
|
||||
|
||||
|
||||
.function cogorc_upsample_horiz_cosite
|
||||
.dest 2 d1 uint8_t
|
||||
.source 1 s1
|
||||
.source 1 s2
|
||||
.temp 1 t1
|
||||
.temp 1 t2
|
||||
|
||||
copyb t1, s1
|
||||
avgub t2, t1, s2
|
||||
mergebw d1, t1, t2
|
||||
|
||||
|
||||
.function cogorc_upsample_vert_avgub
|
||||
.dest 1 d1
|
||||
.source 1 s1
|
||||
.source 1 s2
|
||||
|
||||
avgub d1, s1, s2
|
||||
|
||||
|
||||
|
||||
|
||||
.function orc_unpack_yuyv_y
|
||||
.dest 1 d1
|
||||
.source 2 s1
|
||||
|
||||
select0wb d1, s1
|
||||
|
||||
|
||||
.function orc_unpack_yuyv_u
|
||||
.dest 1 d1
|
||||
.source 4 s1
|
||||
.temp 2 t1
|
||||
|
||||
select0lw t1, s1
|
||||
select1wb d1, t1
|
||||
|
||||
|
||||
.function orc_unpack_yuyv_v
|
||||
.dest 1 d1
|
||||
.source 4 s1
|
||||
.temp 2 t1
|
||||
|
||||
select1lw t1, s1
|
||||
select1wb d1, t1
|
||||
|
||||
|
||||
.function orc_pack_yuyv
|
||||
.dest 4 d1
|
||||
.source 2 s1 uint8_t
|
||||
.source 1 s2
|
||||
.source 1 s3
|
||||
.temp 1 t1
|
||||
.temp 1 t2
|
||||
.temp 2 t3
|
||||
.temp 2 t4
|
||||
.temp 2 t5
|
||||
|
||||
copyw t5, s1
|
||||
select0wb t1, t5
|
||||
select1wb t2, t5
|
||||
mergebw t3, t1, s2
|
||||
mergebw t4, t2, s3
|
||||
mergewl d1, t3, t4
|
||||
|
||||
|
||||
.function orc_unpack_uyvy_y
|
||||
.dest 1 d1
|
||||
.source 2 s1
|
||||
|
||||
select1wb d1, s1
|
||||
|
||||
|
||||
.function orc_unpack_uyvy_u
|
||||
.dest 1 d1
|
||||
.source 4 s1
|
||||
.temp 2 t1
|
||||
|
||||
select0lw t1, s1
|
||||
select0wb d1, t1
|
||||
|
||||
|
||||
.function orc_unpack_uyvy_v
|
||||
.dest 1 d1
|
||||
.source 4 s1
|
||||
.temp 2 t1
|
||||
|
||||
select1lw t1, s1
|
||||
select0wb d1, t1
|
||||
|
||||
|
||||
.function orc_pack_uyvy
|
||||
.dest 4 d1
|
||||
.source 2 s1 uint8_t
|
||||
.source 1 s2
|
||||
.source 1 s3
|
||||
.temp 1 t1
|
||||
.temp 1 t2
|
||||
.temp 2 t3
|
||||
.temp 2 t4
|
||||
.temp 2 t5
|
||||
|
||||
copyw t5, s1
|
||||
select0wb t1, t5
|
||||
select1wb t2, t5
|
||||
mergebw t3, s2, t1
|
||||
mergebw t4, s3, t2
|
||||
mergewl d1, t3, t4
|
||||
|
||||
|
||||
.function orc_memcpy
|
||||
.dest 1 d1 void
|
||||
.source 1 s1 void
|
||||
|
||||
copyb d1, s1
|
||||
|
||||
|
||||
.function orc_addc_convert_u8_s16
|
||||
.dest 1 d1
|
||||
.source 2 s1 int16_t
|
||||
.temp 2 t1
|
||||
|
||||
addw t1, s1, 128
|
||||
convsuswb d1, t1
|
||||
|
||||
|
||||
.function orc_subc_convert_s16_u8
|
||||
.dest 2 d1 int16_t
|
||||
.source 1 s1
|
||||
.temp 2 t1
|
||||
|
||||
convubw t1, s1
|
||||
subw d1, t1, 128
|
||||
|
||||
|
||||
.function orc_splat_u8_ns
|
||||
.dest 1 d1
|
||||
.param 1 p1
|
||||
|
||||
copyb d1, p1
|
||||
|
||||
|
||||
.function orc_splat_s16_ns
|
||||
.dest 2 d1 int16_t
|
||||
.param 2 p1
|
||||
|
||||
copyw d1, p1
|
||||
|
||||
|
||||
.function orc_matrix2_u8
|
||||
.dest 1 d1 uint8_t
|
||||
.source 1 s1 uint8_t
|
||||
.source 1 s2 uint8_t
|
||||
.param 2 p1
|
||||
.param 2 p2
|
||||
.param 2 p3
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
|
||||
convubw t1, s1
|
||||
mullw t1, t1, p1
|
||||
convubw t2, s2
|
||||
mullw t2, t2, p2
|
||||
addw t1, t1, t2
|
||||
addw t1, t1, p3
|
||||
shrsw t1, t1, 6
|
||||
convsuswb d1, t1
|
||||
|
||||
|
||||
.function orc_matrix3_u8
|
||||
.dest 1 d1 uint8_t
|
||||
.source 1 s1 uint8_t
|
||||
.source 1 s2 uint8_t
|
||||
.source 1 s3 uint8_t
|
||||
.param 2 p1
|
||||
.param 2 p2
|
||||
.param 2 p3
|
||||
.param 2 p4
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
|
||||
convubw t1, s1
|
||||
mullw t1, t1, p1
|
||||
convubw t2, s2
|
||||
mullw t2, t2, p2
|
||||
addw t1, t1, t2
|
||||
convubw t2, s3
|
||||
mullw t2, t2, p3
|
||||
addw t1, t1, t2
|
||||
addw t1, t1, p4
|
||||
shrsw t1, t1, 6
|
||||
convsuswb d1, t1
|
||||
|
||||
|
||||
|
||||
.function orc_pack_123x
|
||||
.dest 4 d1 uint32_t
|
||||
.source 1 s1
|
||||
.source 1 s2
|
||||
.source 1 s3
|
||||
.param 1 p1
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
|
||||
mergebw t1, s1, s2
|
||||
mergebw t2, s3, p1
|
||||
mergewl d1, t1, t2
|
||||
|
||||
|
||||
.function orc_pack_x123
|
||||
.dest 4 d1 uint32_t
|
||||
.source 1 s1
|
||||
.source 1 s2
|
||||
.source 1 s3
|
||||
.param 1 p1
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
|
||||
mergebw t1, p1, s1
|
||||
mergebw t2, s2, s3
|
||||
mergewl d1, t1, t2
|
||||
|
||||
|
||||
.function cogorc_combine4_u8
|
||||
.dest 1 d1
|
||||
.source 1 s1
|
||||
.source 1 s2
|
||||
.source 1 s3
|
||||
.source 1 s4
|
||||
.param 2 p1
|
||||
.param 2 p2
|
||||
.param 2 p3
|
||||
.param 2 p4
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
|
||||
convubw t1, s1
|
||||
mullw t1, t1, p1
|
||||
convubw t2, s2
|
||||
mullw t2, t2, p2
|
||||
addw t1, t1, t2
|
||||
convubw t2, s3
|
||||
mullw t2, t2, p3
|
||||
addw t1, t1, t2
|
||||
convubw t2, s4
|
||||
mullw t2, t2, p4
|
||||
addw t1, t1, t2
|
||||
addw t1, t1, 32
|
||||
shrsw t1, t1, 6
|
||||
convsuswb d1, t1
|
||||
|
||||
|
||||
.function cogorc_unpack_ayuv_y
|
||||
.dest 1 d1
|
||||
.source 4 s1
|
||||
.temp 2 t1
|
||||
|
||||
select0lw t1, d1
|
||||
select1wb d1, s1
|
||||
|
||||
|
||||
.function cogorc_unpack_ayuv_u
|
||||
.dest 1 d1
|
||||
.source 4 s1
|
||||
.temp 2 t1
|
||||
|
||||
select1lw t1, d1
|
||||
select0wb d1, s1
|
||||
|
||||
|
||||
.function cogorc_unpack_ayuv_v
|
||||
.dest 1 d1
|
||||
.source 4 s1
|
||||
.temp 2 t1
|
||||
|
||||
select1lw t1, d1
|
||||
select1wb d1, s1
|
||||
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
#include <cog/cog.h>
|
||||
#include <cog/cogframe.h>
|
||||
#include <cog/cogvirtframe.h>
|
||||
#include <cog/cogorc.h>
|
||||
#include "cogorc.h"
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
|
2818
ext/cog/cogorc.c
2818
ext/cog/cogorc.c
File diff suppressed because it is too large
Load diff
|
@ -1,36 +0,0 @@
|
|||
|
||||
/* autogenerated from cog.orc */
|
||||
|
||||
#ifndef _ORC_OUT_H_
|
||||
#define _ORC_OUT_H_
|
||||
|
||||
void cogorc_downsample_horiz_cosite_3tap (uint8_t * d1, uint16_t * s1, uint16_t * s2, int n);
|
||||
void cogorc_downsample_vert_halfsite_2tap (uint8_t * d1, uint8_t * s1, uint8_t * s2, int n);
|
||||
void cogorc_downsample_vert_halfsite_3tap (uint8_t * d1, uint8_t * s1, uint8_t * s2, uint8_t * s3, int n);
|
||||
void cogorc_downsample_vert_halfsite_4tap (uint8_t * d1, uint8_t * s1, uint8_t * s2, uint8_t * s3, uint8_t * s4, int n);
|
||||
void cogorc_upsample_horiz_cosite (uint8_t * d1, uint8_t * s1, uint8_t * s2, int n);
|
||||
void cogorc_upsample_vert_avgub (uint8_t * d1, uint8_t * s1, uint8_t * s2, int n);
|
||||
void orc_unpack_yuyv_y (uint8_t * d1, uint16_t * s1, int n);
|
||||
void orc_unpack_yuyv_u (uint8_t * d1, uint32_t * s1, int n);
|
||||
void orc_unpack_yuyv_v (uint8_t * d1, uint32_t * s1, int n);
|
||||
void orc_pack_yuyv (uint32_t * d1, uint8_t * s1, uint8_t * s2, uint8_t * s3, int n);
|
||||
void orc_unpack_uyvy_y (uint8_t * d1, uint16_t * s1, int n);
|
||||
void orc_unpack_uyvy_u (uint8_t * d1, uint32_t * s1, int n);
|
||||
void orc_unpack_uyvy_v (uint8_t * d1, uint32_t * s1, int n);
|
||||
void orc_pack_uyvy (uint32_t * d1, uint8_t * s1, uint8_t * s2, uint8_t * s3, int n);
|
||||
void orc_memcpy (void * d1, void * s1, int n);
|
||||
void orc_addc_convert_u8_s16 (uint8_t * d1, int16_t * s1, int n);
|
||||
void orc_subc_convert_s16_u8 (int16_t * d1, uint8_t * s1, int n);
|
||||
void orc_splat_u8_ns (uint8_t * d1, int p1, int n);
|
||||
void orc_splat_s16_ns (int16_t * d1, int p1, int n);
|
||||
void orc_matrix2_u8 (uint8_t * d1, uint8_t * s1, uint8_t * s2, int p1, int p2, int p3, int n);
|
||||
void orc_matrix3_u8 (uint8_t * d1, uint8_t * s1, uint8_t * s2, uint8_t * s3, int p1, int p2, int p3, int p4, int n);
|
||||
void orc_pack_123x (uint32_t * d1, uint8_t * s1, uint8_t * s2, uint8_t * s3, int p1, int n);
|
||||
void orc_pack_x123 (uint32_t * d1, uint8_t * s1, uint8_t * s2, uint8_t * s3, int p1, int n);
|
||||
void cogorc_combine4_u8 (uint8_t * d1, uint8_t * s1, uint8_t * s2, uint8_t * s3, uint8_t * s4, int p1, int p2, int p3, int p4, int n);
|
||||
void cogorc_unpack_ayuv_y (uint8_t * d1, uint32_t * s1, int n);
|
||||
void cogorc_unpack_ayuv_u (uint8_t * d1, uint32_t * s1, int n);
|
||||
void cogorc_unpack_ayuv_v (uint8_t * d1, uint32_t * s1, int n);
|
||||
|
||||
#endif
|
||||
|
|
@ -6,13 +6,14 @@
|
|||
#define COG_ENABLE_UNSTABLE_API 1
|
||||
|
||||
#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>
|
||||
|
||||
#include "cogorc.h"
|
||||
|
||||
|
||||
CogFrame *
|
||||
cog_frame_new_virtual (CogMemoryDomain * domain, CogFrameFormat format,
|
||||
|
@ -354,7 +355,7 @@ cog_virt_frame_render_downsample_vert_cosite (CogFrame * frame,
|
|||
src3 = cog_virt_frame_get_line (frame->virt_frame1, component,
|
||||
CLAMP (i * 2 + 1, 0, n_src - 1));
|
||||
|
||||
cogorc_downsample_vert_halfsite_3tap (dest, src1, src2, src3,
|
||||
cogorc_downsample_vert_cosite_3tap (dest, src1, src2, src3,
|
||||
frame->components[component].width);
|
||||
}
|
||||
|
||||
|
@ -1196,9 +1197,8 @@ convert_444_422 (CogFrame * frame, void *_dest, int component, int i)
|
|||
if (component == 0) {
|
||||
orc_memcpy (dest, src, frame->width);
|
||||
} else {
|
||||
cogorc_downsample_horiz_cosite_3tap (dest + 1,
|
||||
(uint16_t *) (src + 1), (uint16_t *) (src + 3),
|
||||
frame->components[component].width - 1);
|
||||
cogorc_downsample_horiz_cosite_1tap (dest + 1,
|
||||
(uint16_t *) (src + 2), frame->components[component].width - 1);
|
||||
|
||||
{
|
||||
int j;
|
||||
|
@ -1226,18 +1226,15 @@ convert_422_420 (CogFrame * frame, void *_dest, int component, int i)
|
|||
uint8_t *dest = _dest;
|
||||
uint8_t *src1;
|
||||
uint8_t *src2;
|
||||
uint8_t *src3;
|
||||
int n_src;
|
||||
|
||||
n_src = frame->virt_frame1->components[component].height;
|
||||
src1 = cog_virt_frame_get_line (frame->virt_frame1, component,
|
||||
CLAMP (i * 2 - 1, 0, n_src - 1));
|
||||
src2 = cog_virt_frame_get_line (frame->virt_frame1, component,
|
||||
CLAMP (i * 2 + 0, 0, n_src - 1));
|
||||
src3 = cog_virt_frame_get_line (frame->virt_frame1, component,
|
||||
src2 = cog_virt_frame_get_line (frame->virt_frame1, component,
|
||||
CLAMP (i * 2 + 1, 0, n_src - 1));
|
||||
|
||||
cogorc_downsample_vert_halfsite_3tap (dest, src1, src2, src3,
|
||||
cogorc_downsample_vert_halfsite_2tap (dest, src1, src2,
|
||||
frame->components[component].width);
|
||||
}
|
||||
}
|
||||
|
@ -1255,8 +1252,12 @@ convert_422_444 (CogFrame * frame, void *_dest, int component, int i)
|
|||
if (component == 0) {
|
||||
orc_memcpy (dest, src, frame->width);
|
||||
} else {
|
||||
cogorc_upsample_horiz_cosite_1tap (dest, src,
|
||||
frame->components[component].width / 2 - 1);
|
||||
#if 0
|
||||
cogorc_upsample_horiz_cosite (dest, src, src + 1,
|
||||
frame->components[component].width / 2 - 1);
|
||||
#endif
|
||||
dest[frame->components[component].width - 2] =
|
||||
src[frame->components[component].width / 2 - 1];
|
||||
dest[frame->components[component].width - 1] =
|
||||
|
@ -1274,6 +1275,7 @@ convert_420_422 (CogFrame * frame, void *_dest, int component, int i)
|
|||
src = cog_virt_frame_get_line (frame->virt_frame1, component, i);
|
||||
orc_memcpy (dest, src, frame->components[component].width);
|
||||
} else {
|
||||
#if 0
|
||||
if ((i & 1) && i < frame->components[component].height - 1) {
|
||||
uint8_t *src2;
|
||||
|
||||
|
@ -1286,6 +1288,10 @@ convert_420_422 (CogFrame * frame, void *_dest, int component, int i)
|
|||
src = cog_virt_frame_get_line (frame->virt_frame1, component, i >> 1);
|
||||
orc_memcpy (dest, src, frame->components[component].width);
|
||||
}
|
||||
#else
|
||||
src = cog_virt_frame_get_line (frame->virt_frame1, component, i >> 1);
|
||||
orc_memcpy (dest, src, frame->components[component].width);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -189,6 +189,8 @@ gst_cogcolorspace_class_init (gpointer g_class, gpointer class_data)
|
|||
base_transform_class->transform = gst_cogcolorspace_transform;
|
||||
base_transform_class->transform_caps = gst_cogcolorspace_transform_caps;
|
||||
base_transform_class->get_unit_size = gst_cogcolorspace_get_unit_size;
|
||||
|
||||
base_transform_class->passthrough_on_same_caps = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue