?? zoom.c
字號:
/* Copyright 1997, ESS Technology, Inc. */
/* SCCSID @(#)zoom.c 1.63 6/11/98 */
/*
* $Log$
*/
#ifdef ZOOM
#include "mvd.h"
#include "common.h"
#include "util.h"
#include "debug.h"
#include "display.h"
#include "zoom.h"
#include "buffer.h"
#include "fsosd.h"
#include "vp.h"
#include "vcxi.h"
#include "play.h"
#ifdef VSCALE
#include "vscale.h"
#endif
#ifdef CUST3
#include "const.h"
#include "custdsa.h"
#endif
#include "xport.h"
static unsigned int U_zoom_start , V_zoom_start, Y_zoom_start;
int save_width1;
int FromBtoB;
static int zoom_y_offset, zoom_uv_offset;
static unsigned int disp_width, disp_height;
PRIVATE void get_pic_size(void);
#ifdef PLAY20
extern int play_state;
#endif
#ifndef BF43
static int UV_location=-1;
#endif
extern int old_bane;
void Zoom_start()
{
int i, j, k, m, tmp;
int dest_u_start, dest_v_start, dest_y_start;
int wY, wUV;
DISP_Info *dip, *dipp;
unsigned int buffer_size, height;
extern int DISP_frame;
int compressed = 0;
int v_start, u_start, y_start;
int width, full_height;
extern int scale_dy_Y, scale_dy_UV;
FromBtoB = 0;
dip = DISP_info + DISP_frame;
full_height = dip->height > 288;
wY = dip->wY;
wUV = dip->wUV;
if (!zoom_y_pos) zoom_y_pos = 2;
k = (zoom_y_pos-2)*wY;
if (full_height || dip->zUV) { /* E2 or E0 with compressing */
zoom_uv_offset = ((zoom_y_pos-2) * wUV + ((zoom_x_pos * 3) >> 4))>>1;
zoom_uv_offset = (zoom_uv_offset+1) / 3 * 3;
tmp = zoom_uv_offset % wUV;
m = zoom_uv_offset - tmp;
if (full_height) {
mvd[vid_scn_misc0] &= 0xfffffffe;
mvd[vid_scn_misc0] |= 0x6000;
zoom_y_offset = (m << 2) + (tmp << 1);
} else {
if (dip->zY)
zoom_y_offset = k + (tmp << 1);
else {
zoom_y_offset = (zoom_uv_offset/wUV * wY) << 1;
zoom_y_offset += ((tmp << 2)/3) << 1;
}
}
}
else { /* E0 without compressing */
zoom_y_offset = k + (zoom_x_pos >> 2);
zoom_uv_offset = ((k + (zoom_x_pos >> 1)) >> 2);
}
zoom_y_offset &= 0xfffffffe;
zoom_uv_offset += zoom_uv_offset/wUV*wUV; /* this is because U, V buffer
is looked like uuuu..vvvv...uuu...vvv.. */
#ifndef BF43
if (UV_location!=-1) {
if (zoom_y_pos) {
i = zoom_y_pos/scale_dy_Y * scale_dy_Y;
}
else
i = 0;
zoom_y_offset -= i*wY;
zoom_uv_offset-= ((i>>1)<<1) * wUV ;
}
#endif
/* When E0 zoom by 2, or E2 zoom by 4, hardware cannot do vscale
as Y,U,V wholely. So, we let hardware do Y vscale, and duplicate
UV ourselfs by store UV to a temperary buffer, and duplicate the
line .
We use VBV buffer as temperary buffer to store U and V, with
duplicated lines.
*/
if (zoom_level == 2 || !dip->zY || DISP_frame == 2) {
#ifndef BF43
/* duplicated copy line */
if(UV_location==-1)
u_start = dip->startU + zoom_uv_offset; /* dword address */
else
u_start = UV_location + zoom_uv_offset; /* dword address */
#else
u_start = dip->startU + zoom_uv_offset; /* dword address */
#endif
v_start = u_start + dip->wUV; /* dword address */
/* width of each line which needed to be duplicated */
if (zoom_level == 1) /* E0 */
#ifndef BF43
if (!old_bane && mineomine) width = 21;
else
#endif
width = (wUV + 1) >> 1;
else /* E2 */
width = (wUV + 3) >> 2;
height = dip->height >> 2;
buffer_size = ((height * width) << 1);
zoom_frame = -1;
switch (DISP_frame) {
case 0:
case 1:
dipp = DISP_info + 2;
U_zoom_start = dipp->startY;
break;
case 2:
zoom_frame = H_VscaleFrame;
if (vcx_scn_vscale != 0x10
#ifdef PLAY20
&& play_state != PLAY_STILL_STATE
&& play_state != PLAY_WAIT_TIME_STATE
&& !is_slide_show
#endif
) {
FromBtoB=1;
dipp = DISP_info + 2;
}
else
{
#ifdef VSCALE
if (H_VscaleFrame == 1)
dipp = DISP_info + 1;
else
dipp = DISP_info + 0;
#else
dipp = DISP_info + 0;
#endif
}
if (zoom_y_pos >= 76)
U_zoom_start = dipp->startY;
else
U_zoom_start = dipp->startU - buffer_size * 2 ;
#ifndef BF43
if (UV_location!=-1)
U_zoom_start = (dipp->startU+dipp->height*dipp->wUV) -(buffer_size<<1) ;
#endif
break;
default:
U_zoom_start = VBV_start; /* E2 picture, zoom_buffer start */
/* at VBV buffer */
break;
}
V_zoom_start = U_zoom_start + buffer_size;
j = 0; m=0;
k = (width *3 ) >> 2;
for (i = 0; i < (dip->height >> 2); i++) {
m = (i * wUV ) << 1;
{
for (k = 0; k < width; k++) {
*(long*) dram(j + width + U_zoom_start) =
*(long*) dram(j + U_zoom_start) =
*(long*)dram(u_start + m);
*(long*) dram(j + width + V_zoom_start) =
*(long*) dram(j + V_zoom_start) =
*(long*)dram(v_start + m);
j++; m++;
asm("nop");
asm("nop");
}
j += width;
}
}
}
#ifndef BF43
if (UV_location!=-1) {
wY = dipp->wY;
width <<=1;
height = dipp->height>>1;
Y_zoom_start = U_zoom_start - height*width;
m = Y_zoom_start;
u_start = dipp->startY + zoom_y_offset; /* dword address */
for (j=0;j<height;j++) {
for (i=0;i<width;i++) {
*(long*)dram(m)=*(long*)dram(u_start);
m++; u_start++;
}
u_start += wY-width;
}
}
#endif
/* with VSCALE on, we cannot use DMA_WIDTH2 register , always set
DMA_WIDTH0 to 0, and DMA_WIDTH1 to real width. */
DISP_change_zoom(zoom_level);
if (zoom_level == 1 && !full_height)
mvd[buscon_dma_width1] = wY >> 1;
}
void zoom_reset()
{
extern int disp_frame;
extern int save_zoom_level;
DO_blank();
zoom_x_pos = 0;
zoom_y_pos = 0;
mvd[buscon_dma_scale_type] = 0;
mvd[buscon_dma_width1] = save_width1;
zoom_level = 0;
DISP_change_zoom(zoom_level);
if (vcx_scn_vscale != 0x10 && DISP_frame==2 && FromBtoB) {
rescaleB();
}
disp_frame = DISP_frame;
}
rescaleB()
{
resetVscale();
initVscale_Pointer();
VscaleStart = 1;
VscaleLastFrame = 0;
while (VscaleStart) vscale2();
}
void zoom_in(void)
{
extern int VID_decoding_in_progress ;
/* If system is not really pause, then ignore zoom_in key */
#ifdef PLAY20
if (XPORT_active && play_state == PLAY_NORMAL_STATE)
return;
#endif
get_pic_size();
#if (!CUST71 && !CUSTDVD) /* For CUST71, this is handled in play.c */
if (disp_height <= 288
#ifdef PLAY20
|| is_slide_show || PLAY_e2_in_loop
#endif
) {
/* For low resolution, only do 2X zoom */
if (zoom_level == 1)
return;
zoom_level = 1;
}
else
#endif /* CUST71 */
{
if (zoom_level == 2)
return;
zoom_level ++;
}
if (zoom_level == 1) {
zoom_x_pos += disp_width >> 2;
zoom_y_pos += disp_height >> 2;
} else
if (zoom_level == 2) {
zoom_x_pos += disp_width >> 3;
zoom_y_pos += disp_height >> 3;
}
save_width1 = mvd[buscon_dma_width1] ;
DO_blank();
#ifndef BF43
UV_location=-1;
if (DISP_frame == 2 && vcx_scn_height == 288
#ifdef PLAY20
&& play_state != PLAY_STILL_STATE
&& play_state != PLAY_WAIT_TIME_STATE
&& !is_slide_show
#endif
) {
Adjust_zoom_XY(zoom_x_pos, zoom_y_pos);
scale_half();
Zoom_start();
return;
}
#endif
pan(zoom_x_pos, zoom_y_pos);
return;
}
void zoom_move_right()
{
zoom_x_pos += HORZ_OFFSET;
pan(zoom_x_pos, zoom_y_pos);
}
void zoom_move_left()
{
zoom_x_pos -= HORZ_OFFSET;
pan(zoom_x_pos, zoom_y_pos);
}
void zoom_move_up()
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -