Skip to content

Instantly share code, notes, and snippets.

@AndreVallestero
Created February 16, 2020 04:23
Show Gist options
  • Save AndreVallestero/25cec827c69a292cc4a92279e9e2876e to your computer and use it in GitHub Desktop.
Save AndreVallestero/25cec827c69a292cc4a92279e9e2876e to your computer and use it in GitHub Desktop.
Removes tiled-yuv in libva-f4l2-request for aarch64 systems rasing an error
src/Makefile.am | 2 -
src/image.c | 15 +----
src/meson.build | 2 -
src/tiled_yuv.S | 185 --------------------------------------------------------
src/tiled_yuv.h | 30 ---------
5 files changed, 3 insertions(+), 231 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 6448884..9615ded 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -42,8 +42,6 @@ v4l2_request_drv_video_la_SOURCES = request.c \
image.h \
utils.c \
utils.h \
- tiled_yuv.S \
- tiled_yuv.h \
video.c \
video.h \
media.c \
diff --git a/src/image.c b/src/image.c
index fa8b0ea..ac86877 100644
--- a/src/image.c
+++ b/src/image.c
@@ -33,7 +33,6 @@
#include <assert.h>
#include <string.h>
-#include "tiled_yuv.h"
#include "utils.h"
#include "v4l2.h"
@@ -155,17 +154,9 @@ static VAStatus copy_surface_to_image (struct request_data *driver_data,
return VA_STATUS_ERROR_INVALID_BUFFER;
for (i = 0; i < surface_object->destination_planes_count; i++) {
- if (!video_format_is_linear(driver_data->video_format))
- tiled_to_planar(surface_object->destination_data[i],
- buffer_object->data + image->offsets[i],
- image->pitches[i], image->width,
- i == 0 ? image->height :
- image->height / 2);
- else {
- memcpy(buffer_object->data + image->offsets[i],
- surface_object->destination_data[i],
- surface_object->destination_sizes[i]);
- }
+ memcpy(buffer_object->data + image->offsets[i],
+ surface_object->destination_data[i],
+ surface_object->destination_sizes[i]);
}
return VA_STATUS_SUCCESS;
diff --git a/src/meson.build b/src/meson.build
index d73abb1..1c7cac8 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -38,7 +38,6 @@ sources = [
'subpicture.c',
'image.c',
'utils.c',
- 'tiled_yuv.S',
'video.c',
'media.c',
'v4l2.c',
@@ -58,7 +57,6 @@ headers = [
'subpicture.h',
'image.h',
'utils.h',
- 'tiled_yuv.h',
'video.h',
'media.h',
'v4l2.h',
diff --git a/src/tiled_yuv.S b/src/tiled_yuv.S
deleted file mode 100644
index c6fa833..0000000
--- a/src/tiled_yuv.S
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (C) 2014 Jens Kuske <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-/*
- * The Sunxi Video Engine outputs buffers in a specific format similar to NV12
- * but with "tiles" of size 32x32. This code converts the data from this tiled
- * format to two NV12 planes.
- */
-
-#if defined(__linux__) && defined(__ELF__)
-.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
-#endif
-
-#ifndef __aarch64__
-
-.text
-.syntax unified
-.arch armv7-a
-.fpu neon
-.thumb
-
-.macro thumb_function fname
- .global \fname
-#ifdef __ELF__
- .hidden \fname
- .type \fname, %function
-#endif
- .thumb_func
-\fname:
-.endm
-
-.macro end_function fname
-#ifdef __ELF__
- .size \fname, .-\fname
-#endif
-.endm
-
-SRC .req r0
-DST .req r1
-PITCH .req r2
-CNT .req r3
-TLINE .req r4
-HEIGHT .req r5
-REST .req r6
-NTILES .req r7
-TMPSRC .req r8
-DST2 .req r9
-TSIZE .req r12
-NEXTLIN .req lr
-
-thumb_function tiled_to_planar
- push {r4, r5, r6, r7, r8, lr}
- ldr HEIGHT, [sp, #24]
- add NEXTLIN, r3, #31
- lsrs NTILES, r3, #5
- bic NEXTLIN, NEXTLIN, #31
- and REST, r3, #31
- lsl NEXTLIN, NEXTLIN, #5
- subs PITCH, r2, r3
- movs TLINE, #32
- rsb NEXTLIN, NEXTLIN, #32
- mov TSIZE, #1024
-
- /* y loop */
-1: cbz NTILES, 3f
- mov CNT, NTILES
-
- /* x loop complete tiles */
-2: pld [SRC, TSIZE]
- vld1.8 {d0 - d3}, [SRC :256], TSIZE
- subs CNT, #1
- vst1.8 {d0 - d3}, [DST]!
- bne 2b
-
-3: cbnz REST, 4f
-
- /* fix up dest pointer if pitch != width */
-7: add DST, PITCH
-
- /* fix up src pointer at end of line */
- subs TLINE, #1
- itee ne
- addne SRC, NEXTLIN
- subeq SRC, #992
- moveq TLINE, #32
-
- subs HEIGHT, #1
- bne 1b
- pop {r4, r5, r6, r7, r8, pc}
-
- /* partly copy last tile of line */
-4: mov TMPSRC, SRC
- tst REST, #16
- beq 5f
- vld1.8 {d0 - d1}, [TMPSRC :128]!
- vst1.8 {d0 - d1}, [DST]!
-5: add SRC, TSIZE
- ands CNT, REST, #15
- beq 7b
-6: vld1.8 {d0[0]}, [TMPSRC]!
- subs CNT, #1
- vst1.8 {d0[0]}, [DST]!
- bne 6b
- b 7b
-end_function tiled_to_planar
-
-thumb_function tiled_deinterleave_to_planar
- push {r4, r5, r6, r7, r8, r9, lr}
- mov DST2, r2
- ldr HEIGHT, [sp, #32]
- ldr r4, [sp, #28]
- add NEXTLIN, r4, #31
- lsrs NTILES, r4, #5
- bic NEXTLIN, NEXTLIN, #31
- ubfx REST, r4, #1, #4
- lsl NEXTLIN, NEXTLIN, #5
- sub PITCH, r3, r4, lsr #1
- movs TLINE, #32
- rsb NEXTLIN, NEXTLIN, #32
- mov TSIZE, #1024
-
- /* y loop */
-1: cbz NTILES, 3f
- mov CNT, NTILES
-
- /* x loop complete tiles */
-2: pld [SRC, TSIZE]
- vld2.8 {d0 - d3}, [SRC :256], TSIZE
- subs CNT, #1
- vst1.8 {d0 - d1}, [DST]!
- vst1.8 {d2 - d3}, [DST2]!
- bne 2b
-
-3: cbnz REST, 4f
-
- /* fix up dest pointer if pitch != width */
-7: add DST, PITCH
- add DST2, PITCH
-
- /* fix up src pointer at end of line */
- subs TLINE, #1
- itee ne
- addne SRC, NEXTLIN
- subeq SRC, #992
- moveq TLINE, #32
-
- subs HEIGHT, #1
- bne 1b
- pop {r4, r5, r6, r7, r8, r9, pc}
-
- /* partly copy last tile of line */
-4: mov TMPSRC, SRC
- tst REST, #8
- beq 5f
- vld2.8 {d0 - d1}, [TMPSRC :128]!
- vst1.8 {d0}, [DST]!
- vst1.8 {d1}, [DST2]!
-5: add SRC, TSIZE
- ands CNT, REST, #7
- beq 7b
-6: vld2.8 {d0[0], d1[0]}, [TMPSRC]!
- subs CNT, #1
- vst1.8 {d0[0]}, [DST]!
- vst1.8 {d1[0]}, [DST2]!
- bne 6b
- b 7b
-end_function tiled_deinterleave_to_planar
-
-#endif
diff --git a/src/tiled_yuv.h b/src/tiled_yuv.h
deleted file mode 100644
index b6da15a..0000000
--- a/src/tiled_yuv.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2014 Jens Kuske <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef _TILED_YUV_H_
-#define _TILED_YUV_H_
-
-void tiled_to_planar(void *src, void *dst, unsigned int dst_pitch,
- unsigned int width, unsigned int height);
-
-void tiled_deinterleave_to_planar(void *src, void *dst1, void *dst2,
- unsigned int dst_pitch, unsigned int width,
- unsigned int height);
-
-#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment