Lines Matching +full:decimation +full:- +full:ratio
1 // SPDX-License-Identifier: GPL-2.0-or-later
43 struct zoran *zr = videocodec_to_zoran(ptr->codec); in zr36050_read()
47 if (ptr->codec->master_data->readreg) in zr36050_read()
48 value = (ptr->codec->master_data->readreg(ptr->codec, reg)) & 0xFF; in zr36050_read()
50 zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name); in zr36050_read()
52 zrdev_dbg(zr, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); in zr36050_read()
59 struct zoran *zr = videocodec_to_zoran(ptr->codec); in zr36050_write()
61 zrdev_dbg(zr, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); in zr36050_write()
64 if (ptr->codec->master_data->writereg) in zr36050_write()
65 ptr->codec->master_data->writereg(ptr->codec, reg, value); in zr36050_write()
68 ptr->name); in zr36050_write()
74 ptr->status1 = zr36050_read(ptr, ZR050_STATUS_1); in zr36050_read_status1()
77 return ptr->status1; in zr36050_read_status1()
83 ptr->scalefact = (zr36050_read(ptr, ZR050_SF_HI) << 8) | in zr36050_read_scalefactor()
88 return ptr->scalefact; in zr36050_read_scalefactor()
99 struct zoran *zr = videocodec_to_zoran(ptr->codec); in zr36050_wait_end()
107 ptr->name, ptr->status1); in zr36050_wait_end()
120 struct zoran *zr = videocodec_to_zoran(ptr->codec); in zr36050_basic_test()
128 ptr->name); in zr36050_basic_test()
129 return -ENXIO; in zr36050_basic_test()
137 ptr->name); in zr36050_basic_test()
138 return -ENXIO; in zr36050_basic_test()
142 if ((ptr->status1 & 0x4) == 0) { in zr36050_basic_test()
145 ptr->name); in zr36050_basic_test()
146 return -EBUSY; in zr36050_basic_test()
156 struct zoran *zr = videocodec_to_zoran(ptr->codec); in zr36050_pushit()
159 zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, in zr36050_pushit()
265 /* horizontal 422 decimation setup (maybe we support 411 or so later, too) */
272 * calculation and setup of parameter-dependent JPEG baseline segments
276 /* ------------------------------------------------------------------------- */
279 * SOF (start of frame) segment depends on width, height and sampling ratio
284 struct zoran *zr = videocodec_to_zoran(ptr->codec); in zr36050_set_sof()
288 zrdev_dbg(zr, "%s: write SOF (%dx%d, %d components)\n", ptr->name, in zr36050_set_sof()
289 ptr->width, ptr->height, NO_OF_COMPONENTS); in zr36050_set_sof()
295 sof_data[5] = (ptr->height) >> 8; in zr36050_set_sof()
296 sof_data[6] = (ptr->height) & 0xff; in zr36050_set_sof()
297 sof_data[7] = (ptr->width) >> 8; in zr36050_set_sof()
298 sof_data[8] = (ptr->width) & 0xff; in zr36050_set_sof()
302 sof_data[11 + (i * 3)] = (ptr->h_samp_ratio[i] << 4) | in zr36050_set_sof()
303 (ptr->v_samp_ratio[i]); // sampling ratios in zr36050_set_sof()
310 /* ------------------------------------------------------------------------- */
319 struct zoran *zr = videocodec_to_zoran(ptr->codec); in zr36050_set_sos()
323 zrdev_dbg(zr, "%s: write SOS\n", ptr->name); in zr36050_set_sos()
341 /* ------------------------------------------------------------------------- */
347 struct zoran *zr = videocodec_to_zoran(ptr->codec); in zr36050_set_dri()
350 zrdev_dbg(zr, "%s: write DRI\n", ptr->name); in zr36050_set_dri()
355 dri_data[4] = ptr->dri >> 8; in zr36050_set_dri()
356 dri_data[5] = ptr->dri & 0xff; in zr36050_set_dri()
372 struct zoran *zr = videocodec_to_zoran(ptr->codec); in zr36050_init()
374 if (ptr->mode == CODEC_DO_COMPRESSION) { in zr36050_init()
375 zrdev_dbg(zr, "%s: COMPRESSION SETUP\n", ptr->name); in zr36050_init()
390 /*zr36050_write(ptr, ZR050_MBCV, ptr->max_block_vol);*/ in zr36050_init()
391 zr36050_write(ptr, ZR050_SF_HI, ptr->scalefact >> 8); in zr36050_init()
392 zr36050_write(ptr, ZR050_SF_LO, ptr->scalefact & 0xff); in zr36050_init()
404 * setup the fixed jpeg tables - maybe variable, though - in zr36050_init()
407 zrdev_dbg(zr, "%s: write DQT, DHT, APP\n", ptr->name); in zr36050_init()
413 zr36050_write(ptr, ZR050_APP_IDX + 1, 0xe0 + ptr->app.appn); in zr36050_init()
415 zr36050_write(ptr, ZR050_APP_IDX + 3, ptr->app.len + 2); in zr36050_init()
417 ptr->app.data) + 4; in zr36050_init()
421 zr36050_write(ptr, ZR050_COM_IDX + 3, ptr->com.len + 2); in zr36050_init()
423 ptr->com.data) + 4; in zr36050_init()
431 ptr->name, ptr->status1); in zr36050_init()
433 if ((ptr->status1 & 0x4) == 0) { in zr36050_init()
434 zrdev_err(zr, "%s: init aborted!\n", ptr->name); in zr36050_init()
441 sum = ptr->real_code_vol - sum; in zr36050_init()
447 ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); in zr36050_init()
454 bitcnt -= bitcnt >> 7; // bits without stuffing in zr36050_init()
455 bitcnt -= ((bitcnt * 5) >> 6); // bits without eob in zr36050_init()
459 ptr->name, bitcnt, tmp); in zr36050_init()
469 (ptr->bitrate_ctrl ? ZR050_MO_BRC : 0)); in zr36050_init()
474 ((ptr->app.len > 0) ? ZR050_ME_APP : 0) | in zr36050_init()
475 ((ptr->com.len > 0) ? ZR050_ME_COM : 0)); in zr36050_init()
477 zrdev_dbg(zr, "%s: EXPANSION SETUP\n", ptr->name); in zr36050_init()
490 zrdev_dbg(zr, "%s: write DHT\n", ptr->name); in zr36050_init()
500 ptr->name, ptr->status1); in zr36050_init()
502 if ((ptr->status1 & 0x4) == 0) { in zr36050_init()
503 zrdev_err(zr, "%s: init aborted!\n", ptr->name); in zr36050_init()
523 * set compression/expansion mode and launches codec -
528 struct zr36050 *ptr = (struct zr36050 *)codec->data; in zr36050_set_mode()
531 zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode); in zr36050_set_mode()
534 return -EINVAL; in zr36050_set_mode()
536 ptr->mode = mode; in zr36050_set_mode()
546 struct zr36050 *ptr = (struct zr36050 *)codec->data; in zr36050_set_video()
550 zrdev_dbg(zr, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) q%d call\n", in zr36050_set_video()
551 ptr->name, norm->h_start, norm->v_start, in zr36050_set_video()
552 cap->x, cap->y, cap->width, cap->height, in zr36050_set_video()
553 cap->decimation, cap->quality); in zr36050_set_video()
555 * trust the master driver that it knows what it does - so in zr36050_set_video()
558 ptr->width = cap->width / (cap->decimation & 0xff); in zr36050_set_video()
559 ptr->height = cap->height / ((cap->decimation >> 8) & 0xff); in zr36050_set_video()
562 size = ptr->width * ptr->height; in zr36050_set_video()
565 size = size * cap->quality / 200; in zr36050_set_video()
571 if (size > ptr->total_code_vol * 7) in zr36050_set_video()
572 size = ptr->total_code_vol * 7; in zr36050_set_video()
574 ptr->real_code_vol = size >> 3; /* in bytes */ in zr36050_set_video()
580 zr36050_write(ptr, ZR050_MBCV, ptr->max_block_vol); in zr36050_set_video()
588 struct zr36050 *ptr = (struct zr36050 *)codec->data; in zr36050_control()
592 zrdev_dbg(zr, "%s: control %d call with %d byte\n", ptr->name, type, in zr36050_control()
598 return -EFAULT; in zr36050_control()
600 *ival = ptr->status1; in zr36050_control()
605 return -EFAULT; in zr36050_control()
611 return -EFAULT; in zr36050_control()
613 return -EINVAL; in zr36050_control()
624 return -ENXIO; in zr36050_control()
628 return -EFAULT; in zr36050_control()
629 *ival = ptr->total_code_vol; in zr36050_control()
634 return -EFAULT; in zr36050_control()
635 ptr->total_code_vol = *ival; in zr36050_control()
636 ptr->real_code_vol = (ptr->total_code_vol * 6) >> 3; in zr36050_control()
641 return -EFAULT; in zr36050_control()
647 return -EFAULT; in zr36050_control()
648 ptr->scalefact = *ival; in zr36050_control()
655 return -EFAULT; in zr36050_control()
657 *app = ptr->app; in zr36050_control()
665 return -EFAULT; in zr36050_control()
667 ptr->app = *app; in zr36050_control()
675 return -EFAULT; in zr36050_control()
677 *com = ptr->com; in zr36050_control()
685 return -EFAULT; in zr36050_control()
687 ptr->com = *com; in zr36050_control()
692 return -EINVAL; in zr36050_control()
702 struct zr36050 *ptr = codec->data; in zr36050_unset()
708 zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, in zr36050_unset()
709 ptr->num); in zr36050_unset()
711 codec->data = NULL; in zr36050_unset()
713 zr36050_codecs--; in zr36050_unset()
717 return -EFAULT; in zr36050_unset()
741 return -ENOSPC; in zr36050_setup()
745 codec->data = ptr; in zr36050_setup()
747 return -ENOMEM; in zr36050_setup()
749 snprintf(ptr->name, sizeof(ptr->name), "zr36050[%d]", in zr36050_setup()
751 ptr->num = zr36050_codecs++; in zr36050_setup()
752 ptr->codec = codec; in zr36050_setup()
761 memcpy(ptr->h_samp_ratio, zr36050_decimation_h, 8); in zr36050_setup()
762 memcpy(ptr->v_samp_ratio, zr36050_decimation_v, 8); in zr36050_setup()
764 /* 0 or 1 - fixed file size flag (what is the difference?) */ in zr36050_setup()
765 ptr->bitrate_ctrl = 0; in zr36050_setup()
766 ptr->mode = CODEC_DO_COMPRESSION; in zr36050_setup()
767 ptr->width = 384; in zr36050_setup()
768 ptr->height = 288; in zr36050_setup()
769 ptr->total_code_vol = 16000; in zr36050_setup()
770 ptr->max_block_vol = 240; in zr36050_setup()
771 ptr->scalefact = 0x100; in zr36050_setup()
772 ptr->dri = 1; in zr36050_setup()
775 ptr->app.appn = 0; in zr36050_setup()
776 ptr->app.len = 0; in zr36050_setup()
777 ptr->com.len = 0; in zr36050_setup()
782 ptr->name); in zr36050_setup()
813 pr_debug("zr36050: something's wrong - %d codecs left somehow.\n", in zr36050_cleanup_module()