Skip to content

Commit

Permalink
cedarv: remove asm in cpp to avoid build error
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Jul 20, 2015
1 parent e5e771b commit 61be1d6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 132 deletions.
3 changes: 1 addition & 2 deletions config.tests/libcedarv/libcedardrv.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG -= qt
CONFIG += console
SOURCES += main.cpp

LIBS += -lvecore -lcedarv
include(../paths.pri)
3 changes: 2 additions & 1 deletion config.tests/paths.pri
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ TEMPLATE = lib # can not create exe for some platforms (winrt, ios)
# not static lib because sometimes we need to check link flags
INCLUDEPATH += $$[QT_INSTALL_HEADERS]
LIBS += -L$$[QT_INSTALL_LIBS]
CONFIG -= app_bundle lib_bundle
CONFIG -= qt app_bundle lib_bundle
CONFIG += console
130 changes: 2 additions & 128 deletions src/codec/video/VideoDecoderCedarv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ extern "C" {
#include "utils/Logger.h"

// TODO: neon+nv12+opengl crash

#ifndef NO_NEON_OPT //Don't HAVE_NEON
extern "C" {
// from libvdpau-sunxi
Expand Down Expand Up @@ -195,131 +194,6 @@ static void map32x32_to_nv12_UV(void* srcC, void* tarUV, unsigned int dst_pitch,
}
}
#endif
#ifndef NO_NEON_OPT //Don't HAVE_NEON
// use tiled_to_planar instead
static void map32x32_to_yuv_Y_neon(void* srcY, void* tarY, unsigned int dst_pitch, unsigned int coded_width,unsigned int coded_height)
{
unsigned long offset;
unsigned char *dst_asm,*src_asm;

unsigned char *ptr = (unsigned char *)srcY;
const unsigned int mb_width = (coded_width+15) >> 4;
const unsigned int mb_height = (coded_height+15) >> 4;
const unsigned int twomb_line = (mb_height+1) >> 1;
const unsigned int twomb_width = mb_width/2;
for (unsigned int i = 0; i < twomb_line; i++) {
const int M = i*32;
for (unsigned int j = 0; j < twomb_width; j++) {
const unsigned int n= j*32;
offset = M*dst_pitch + n;
for (unsigned int l=0;l<32;l++) {
//first mb
dst_asm = (unsigned char *)tarY + offset;
src_asm = ptr;
asm volatile (
"vld1.8 {d0 - d3}, [%[src_asm]] \n\t"
"vst1.8 {d0 - d3}, [%[dst_asm]] \n\t"
: [dst_asm] "+r" (dst_asm), [src_asm] "+r" (src_asm)
: //[srcY] "r" (srcY)
: "cc", "memory", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d28", "d29", "d30", "d31"
);
offset += dst_pitch;
ptr += 32;
}
}

//LOGV("mb_width:%d",mb_width);
if(mb_width & 1) {
unsigned int j = mb_width-1;
const unsigned int n = j*16;
offset = M*dst_pitch + n;
for (unsigned int l = 0; l < 32; l++) {
//first mb
if (M+l<coded_height && n<coded_width) {
dst_asm = (unsigned char *)tarY + offset;
src_asm = ptr;
asm volatile (
"vld1.8 {d0 - d1}, [%[src_asm]] \n\t"
"vst1.8 {d0 - d1}, [%[dst_asm]] \n\t"
: [dst_asm] "+r" (dst_asm), [src_asm] "+r" (src_asm)
: //[srcY] "r" (srcY)
: "cc", "memory", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d28", "d29", "d30", "d31"
);
}
offset += dst_pitch;
ptr += 32;
}
}
}
}
// use tiled_deinterleave_to_planar instead
static void map32x32_to_yuv_C_neon(void* srcC, void* tarCb, void* tarCr, unsigned int dst_pitch, unsigned int coded_width, unsigned int coded_height)
{
coded_width /= 2; // libvdpau-sunxi compatible
unsigned int j,l,k;
unsigned long offset;
unsigned char *dst0_asm,*dst1_asm,*src_asm;
unsigned char line[16];
int dst_stride = FFALIGN(coded_width, 16);

unsigned char *ptr = (unsigned char *)srcC;
const unsigned int mb_width = (coded_width+7)>>3;
const unsigned int mb_height = (coded_height+7)>>3;
const unsigned int fourmb_line = (mb_height+3)>>2;
const unsigned int twomb_width = mb_width/2;

for (unsigned int i = 0; i < fourmb_line; i++) {
const int M = i*32;
for (j = 0; j < twomb_width; j++) {
const unsigned int n = j*16;
offset = M*dst_stride + n;
for (l = 0; l < 32; l++) {
//first mb
if (M+l<coded_height && n<coded_width) {
dst0_asm = (unsigned char *)tarCb + offset;
dst1_asm = (unsigned char *)tarCr + offset;
src_asm = ptr;
// for(k=0;k<16;k++)
// {
// dst0_asm[k] = src_asm[2*k];
// dst1_asm[k] = src_asm[2*k+1];
// }
asm volatile (
"vld1.8 {d0 - d3}, [%[src_asm]] \n\t"
"vuzp.8 d0, d1 \n\t"
"vuzp.8 d2, d3 \n\t"
"vst1.8 {d0}, [%[dst0_asm]]! \n\t"
"vst1.8 {d2}, [%[dst0_asm]]! \n\t"
"vst1.8 {d1}, [%[dst1_asm]]! \n\t"
"vst1.8 {d3}, [%[dst1_asm]]! \n\t"
: [dst0_asm] "+r" (dst0_asm), [dst1_asm] "+r" (dst1_asm), [src_asm] "+r" (src_asm)
: //[srcY] "r" (srcY)
: "cc", "memory", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d28", "d29", "d30", "d31"
);
}
offset += dst_pitch;
ptr += 32;
}
}
if (mb_width & 1) {
j = mb_width-1;
for (l = 0; l < 32; l++) {
const unsigned int n = j*8;
offset = M*dst_stride + n;
if (M+l<coded_height && n<coded_width) {
memcpy(line, ptr, 16);
for(k = 0; k < 8; k++) {
*((unsigned char *)tarCb + offset + k) = line[2*k];
*((unsigned char *)tarCr + offset + k) = line[2*k+1];
}
}
offset += dst_stride;
ptr += 32;
}
}
}
}
#endif

typedef struct {
enum AVCodecID id;
Expand Down Expand Up @@ -443,8 +317,8 @@ void VideoDecoderCedarv::setNeon(bool value)
DPTR_D(VideoDecoderCedarv);
if (value) {
#ifndef NO_NEON_OPT //Don't HAVE_NEON
d.map_y = tiled_to_planar;// map32x32_to_yuv_Y_neon;
d.map_c = tiled_deinterleave_to_planar;// map32x32_to_yuv_C_neon;
d.map_y = tiled_to_planar;
d.map_c = tiled_deinterleave_to_planar;
#endif
} else {
d.map_y = map32x32_to_yuv_Y;
Expand Down
3 changes: 2 additions & 1 deletion src/libQtAV.pro
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ config_vaapi* {
config_libcedarv {
DEFINES *= QTAV_HAVE_CEDARV=1
QMAKE_CXXFLAGS *= -march=armv7-a
NEON_SOURCES += codec/video/VideoDecoderCedarv.cpp
# Can not use NEON_SOURCE because it can not work with moc
SOURCES += codec/video/VideoDecoderCedarv.cpp
!config_simd: CONFIG *= simd #addSimdCompiler xxx_ASM
CONFIG += no_clang_integrated_as #see qtbase/src/gui/painting/painting.pri. add -fno-integrated-as from simd.prf
NEON_ASM += codec/video/tiled_yuv.S #from libvdpau-sunxi
Expand Down

0 comments on commit 61be1d6

Please sign in to comment.