Lines Matching +full:sd +full:- +full:lines

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Derived from ivtv-vbi.c
10 #include "cx18-driver.h"
11 #include "cx18-vbi.h"
12 #include "cx18-ioctl.h"
13 #include "cx18-queue.h"
25 static void copy_vbi_data(struct cx18 *cx, int lines, u32 pts_stamp) in copy_vbi_data() argument
32 /* MPEG-2 Program Pack */ in copy_vbi_data()
37 /* MPEG-2 Private Stream 1 PES Packet */ in copy_vbi_data()
44 const int sd = sizeof(mpeg_hdr_data); /* start of vbi data */ in copy_vbi_data() local
45 int idx = cx->vbi.frame % CX18_VBI_FRAMES; in copy_vbi_data()
46 u8 *dst = &cx->vbi.sliced_mpeg_data[idx][0]; in copy_vbi_data()
48 for (i = 0; i < lines; i++) { in copy_vbi_data()
49 struct v4l2_sliced_vbi_data *sdata = cx->vbi.sliced_data + i; in copy_vbi_data()
52 if (sdata->id == 0) in copy_vbi_data()
55 l = sdata->line - 6; in copy_vbi_data()
56 f = sdata->field; in copy_vbi_data()
62 linemask[1] |= (1 << (l - 32)); in copy_vbi_data()
63 dst[sd + 12 + line * 43] = cx18_service2vbi(sdata->id); in copy_vbi_data()
64 memcpy(dst + sd + 12 + line * 43 + 1, sdata->data, 42); in copy_vbi_data()
69 /* All lines are used, so there is no space for the linemask in copy_vbi_data()
72 memcpy(dst + sd, "ITV0", 4); in copy_vbi_data()
73 memmove(dst + sd + 4, dst + sd + 12, line * 43); in copy_vbi_data()
76 memcpy(dst + sd, "itv0", 4); in copy_vbi_data()
79 memcpy(dst + sd + 4, &linemask[0], 8); in copy_vbi_data()
89 cx->vbi.sliced_mpeg_size[idx] = sd + size; in copy_vbi_data()
94 /* FIXME - this function ignores the input size. */
98 u32 lines = cx->vbi.count * 2; in compress_raw_buf() local
106 for (i = 0; i < lines; i++) { in compress_raw_buf()
114 if (i == lines - 1) { in compress_raw_buf()
115 /* last line is hdr_size bytes short - extrapolate it */ in compress_raw_buf()
116 memcpy(q, p + 4, line_size - 4 - hdr_size); in compress_raw_buf()
117 q += line_size - 4 - hdr_size; in compress_raw_buf()
118 p += line_size - hdr_size - 1; in compress_raw_buf()
121 memcpy(q, p + 4, line_size - 4); in compress_raw_buf()
122 q += line_size - 4; in compress_raw_buf()
125 return lines * (line_size - 4); in compress_raw_buf()
134 u32 line_size = cx->is_60hz ? VBI_HBLANK_SAMPLES_60HZ in compress_sliced_buf()
150 size -= (i - hdr_size); in compress_sliced_buf()
163 v4l2_subdev_call(cx->sd_av, vbi, decode_vbi_line, &vbi); in compress_sliced_buf()
165 cx->vbi.sliced_data[line].id = vbi.type; in compress_sliced_buf()
166 cx->vbi.sliced_data[line].field = vbi.is_second_field; in compress_sliced_buf()
167 cx->vbi.sliced_data[line].line = vbi.line; in compress_sliced_buf()
168 memcpy(cx->vbi.sliced_data[line].data, vbi.p, 42); in compress_sliced_buf()
185 } *hdr = (struct vbi_data_hdr *) buf->buf; in _cx18_process_vbi_data()
187 u8 *p = (u8 *) buf->buf; in _cx18_process_vbi_data()
188 u32 size = buf->bytesused; in _cx18_process_vbi_data()
190 int lines; in _cx18_process_vbi_data() local
193 * The CX23418 sends us data that is 32 bit little-endian swapped, in _cx18_process_vbi_data()
202 size = buf->bytesused = in _cx18_process_vbi_data()
209 p += size - 4; in _cx18_process_vbi_data()
210 memcpy(p, &cx->vbi.frame, 4); in _cx18_process_vbi_data()
211 cx->vbi.frame++; in _cx18_process_vbi_data()
217 pts = (be32_to_cpu(hdr->magic) == 0x3fffffff) ? be32_to_cpu(hdr->pts) in _cx18_process_vbi_data()
220 lines = compress_sliced_buf(cx, p, size, sizeof(struct vbi_data_hdr)); in _cx18_process_vbi_data()
223 if (lines == 0) { in _cx18_process_vbi_data()
224 cx->vbi.sliced_data[0].id = 0; in _cx18_process_vbi_data()
225 cx->vbi.sliced_data[0].line = 0; in _cx18_process_vbi_data()
226 cx->vbi.sliced_data[0].field = 0; in _cx18_process_vbi_data()
227 lines = 1; in _cx18_process_vbi_data()
229 buf->bytesused = size = lines * sizeof(cx->vbi.sliced_data[0]); in _cx18_process_vbi_data()
230 memcpy(p, &cx->vbi.sliced_data[0], size); in _cx18_process_vbi_data()
232 if (cx->vbi.insert_mpeg) in _cx18_process_vbi_data()
233 copy_vbi_data(cx, lines, pts); in _cx18_process_vbi_data()
234 cx->vbi.frame++; in _cx18_process_vbi_data()
256 list_for_each_entry(buf, &mdl->buf_list, list) { in cx18_process_vbi_data()
257 orig_used = buf->bytesused; in cx18_process_vbi_data()
261 mdl->bytesused -= (orig_used - buf->bytesused); in cx18_process_vbi_data()