-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrk_video.c
105 lines (89 loc) · 3.07 KB
/
rk_video.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* For rk3066
* Author: olegk0 <olegvedi@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rk_layers_priv.h"
#include <string.h>
//convert packed U0Y0V0Y1 U2Y2V2Y3 to SemiPlanar for display
//YVYU and YUY2
void OvlCopyPackedToFb(OvlMemPgPtr PMemPg, const void *src, int dstPitch, int srcPitch, int w, int h, Bool reverse)
{
void *dst_Y = ToIntMemPg(PMemPg)->fb_mmap;
void *dst_UV = dst_Y;
if(reverse)
dst_Y += ToIntMemPg(PMemPg)->offset_uv;
else
dst_UV += ToIntMemPg(PMemPg)->offset_uv;
struct yuv_pack in = {src, srcPitch};
struct y_uv_planes out = {dst_Y, dst_UV, dstPitch};
// struct y_uv_planes out = {dst_Y, dst_UV, w};
yuyv_semiplanar_neon (&out, &in, w, h);
}
//-----------------------------------------------------------------
// YV12 and I420
void OvlCopyPlanarToFb(OvlMemPgPtr PMemPg, const void *src_Y, const void *src_U, const void *src_V,
int dstPitch, int srcPitch_y, int srcPitch_c, int w, int h)
{
void *dst_Y = ToIntMemPg(PMemPg)->fb_mmap;
void *dst_UV = dst_Y + ToIntMemPg(PMemPg)->offset_uv;
int i;
if((dstPitch | srcPitch_y) & 3){
for(i=0;i<h;i++){
memcpy(dst_Y, src_Y, w);
dst_Y += dstPitch;
src_Y += srcPitch_y;
}
}else{
struct y_copy inY = {dst_Y, src_Y, srcPitch_y};
copy_neon (&inY, dstPitch, w, h);
}
// }
/*
for(i=0;i<h;i++){
memcpy(dst_Y, src_Y, w);
dst_Y += dstPitch;
src_Y += w;
}
*/
struct yuv_pack out = {dst_UV, dstPitch};
// struct yuv_pack out = {dst_UV, w};
struct uv_planes in = {src_U, src_V, srcPitch_c};
interleave_chroma_neon (&out, &in, w, h);
}
void OvlCopyNV12SemiPlanarToFb(OvlMemPgPtr PMemPg, const void *src_Y, const void *src_UV,
int dstPitch, int srcPitch, int w, int h)
{
void *dst_Y = ToIntMemPg(PMemPg)->fb_mmap;
void *dst_UV = dst_Y + ToIntMemPg(PMemPg)->offset_uv;
struct y_copy inY = {dst_Y, src_Y, srcPitch};
copy_neon (&inY, dstPitch, w, h);
// copy_neon (&inY, w, w, h);
struct y_copy in = {dst_UV, src_UV, srcPitch};
copy_neon (&in, dstPitch, w, h>>1);
// copy_neon (&in, w, w, h>>1);
}
void OvlCopyNV16SemiPlanarToFb(OvlMemPgPtr PMemPg, const void *src_Y, const void *src_UV,
int dstPitch, int srcPitch, int w, int h)
{
void *dst_Y = ToIntMemPg(PMemPg)->fb_mmap;
void *dst_UV = dst_Y + ToIntMemPg(PMemPg)->offset_uv;
struct y_copy inY = {dst_Y, src_Y, srcPitch};
copy_neon (&inY, dstPitch, w, h);
// copy_neon (&inY, w, w, h);
struct y_copy in = {dst_UV, src_UV, srcPitch};
copy_neon (&in, dstPitch, w, h);
// copy_neon (&in, w, w, h);
}