📄 digest.c
字号:
vcx_playaudio_only = 0; I_am_searching = 1; vcx_fade_audio_volume = 0x1010; /* No longer fading */#ifdef CUST71 vcx_audio_volume = 0;#endif }#ifdef FADING_CONTROL else if (audioTimeLeft < (1<<7)) { vcx_fade_audio_volume = ((vcx_audio_volume & 0xff) * audioTimeLeft) >> 7; vcx_fade_audio_volume += vcx_fade_audio_volume << 8; } else vcx_fade_audio_volume = 0x1010;#ifdef CUST71 vcx_audio_volume = 0;#endif#endif /* FADING_CONTROL */ if (I_am_searching /*|| (digest_out_tmr && (digest_out_tmr < glbTimer))*/) {#ifndef PLAYONLY if (digest_out_tmr) { digest_out_tmr = 0; subDigestFinish = 1; /* Set to paint number */ frame_count = 0; /* reset frame count */ } if (((digest_track + (vcx_subDigestPerPage-1)) % vcx_subDigestPerPage) >= (vcx_subDigestPerPage-1) ||#ifdef CUST3_63 (currCDtime >= adjCDtime(CDinfo.leadout, 0x400, -1))||#endif ((digest_mode == DIGEST_DISC_MODE) && (digest_track >= #ifdef CUST3 ((last_track > MAX_TRACK_SUPPORTED) ? MAX_TRACK_SUPPORTED : last_track)) ))#else last_track)))#endif { extern void turn_off_data(); if (!digestDone) { digestDone = 1; digestAudioStart = 0; turn_off_data(); /* Safer than setting TDM_off */ clear_dec(); /* Reset VBV pointers, since we do not need to do any more video decoding. */#if (CUST3 && !CUST71) if (!pause_sent) { dsa_cmd(DSA_PAUSE_AHEAD, 0, 0, 0); pause_sent = 1; }#endif#ifdef CUST71 dsa_pause();#endif } } else#endif {#if (CUST3 && !CUST71) pause_sent = 0;#endif#ifdef CUST4 /* CUST4 may be in pause..don't decode next window */ if (!vcx_pause) #endif {#ifdef MOVING_DIGEST if (digest_track != 9) { int tmp = (digest_track - 1)%num_of_digest_windows; DGST_move_window(4, move_window[tmp]); }#endif digest_track++;#ifdef CUST71 if (play_state == PLAY_CD_DIGEST_STATE) { addMicroRing(0x2100 |digest_track); show_panel_time(0); }#endif digestAdvanceTrack(); } } } } } else if ((digest_mode == DIGEST_MOTION_MODE) && subDigestFinish) {#ifdef CUST4 if (cur_playmode != PLAYMODE_STROBE9)#endif dgst_wr_num(digest_track, COLOR_WHITE, COLOR_BLACK, 8, FILL_E2); }}/************************************************************************ * Global function. Reset digest related things. ************************************************************************/void resetDigest(){#if (CUST3 && !CUST71) pause_sent = 0;#endif /* reset global variables when we are not in digest mode. */ vcx_digest = 0; I_am_searching = 0; vcx_playaudio_only = 0; digestAudioStart = 0; subDigestFinish = 0; digest_track = 0; /* reset the starting digest track number */ if (digestInited) { digestInited = 0;#ifdef CUST71 vcx_audio_volume = vcx_audio_volume_old;#else vcx_fade_audio_volume = 0x1010;#endif } system_reset();#ifndef ZOOM done_blank = 0; do_blank = 1; /* Display a tiny screen to blank screen */ /* * We'll wait here for up to 1/60th of a second until the * screen is blanked out. During this period of time, I want to * continue my communication with DSA and the external * microprocessor */ do receive_dsa(); while(!done_blank);#if 0 fill_screen(COLOR_BLACK);#endif do_blank = 0; /* Don't need to blank screen any more */#else DO_blank();#endif DISP_change_resolution(vcx_HorizSz, vcx_VertSz);#if 0 install_filter_coeffs(h_filters[0], h_filters[1]);#endif }/************************************************************************ * Global function. One I frame has been digested, reset the frame_count. ************************************************************************/void signalFinishSubDigest(int orNot){#ifdef CUST4 int end_subdigest;#endif if (orNot) { /* normalize it */ frame_count++; } #ifdef CUST4 if (cur_playmode == PLAYMODE_STROBE9) /* for CUST4 just show single I-frame per window for STROBE9 */ end_subdigest = orNot; else { end_subdigest = ((orNot && (frame_count > DGST_MAXFRAME)) || PLAY_next_subdigest); } subDigestFinish = end_subdigest;#else subDigestFinish = (orNot && (frame_count > DGST_MAXFRAME)); #endif /* CUST4 */ if (subDigestFinish) { frame_count=0;#ifdef CUST4 /* This is STROBE9 mode */ if (cur_playmode == PLAYMODE_STROBE9) { if (digest_track < 9) digest_track++; else digest_track = 1; }#endif /* CUST4 */ }}/************************************************************************ * Global function. Check if the macroblock is out of the display range. ************************************************************************/int checkSubDigestRange(int MBRow, int MBColumn){ int tmpMBRow; int tmpMBColumn; tmpMBRow = MBRow; tmpMBColumn = MBColumn; if (vcx_subDigestPerPage == 9) { tmpMBRow>>=1; tmpMBColumn>>=1; } /* Check if the macro block is in the subdigest picture range. */ return((tmpMBColumn>=Hgap) && tmpMBColumn <(Hgap+XoffsetEndY) && (tmpMBRow>=Vgap) && tmpMBRow < (Vgap+YoffsetEndY) );}/************************************************************************ * Global function. Tell the play control what the current track is. ************************************************************************/int current_digest_track(){ return (digest_track);}/************************************************************************ * Digest OSD. * Write a number at special position, number can not be larger than 99. ************************************************************************/#ifdef NEW_DIGEST_OSDint top_left;PRIVATE void one_byte_becomes_one_dword(int b, int *dw){ int i, x; char *cp; x = *dw; cp = (char *)(&x); for (i=0; i<4; i++) { switch (b & 0xc0) { case 0xc0: *cp = 0x7b; break; case 0x40: *cp = 0xb2; break; } b <<= 2; cp++; } *dw = x;}PRIVATE void DGST_overlay(int num, int addr){ int *fp = (int *)(T_dgs_font + 16*num); int *dp = (int *)dram(addr); int i, j, dw; char *cp; for (j=0;j<DGST_FHEIGHT;j++) { dw = *fp++; cp = (char *)(&dw); for (i=0;i<4;i++) { one_byte_becomes_one_dword(*cp, dp); cp++; dp++; } dp += 4; } }PRIVATE void DGST_wr_num(int num) { int dst = DISP_END - (26*8) - (32*16/4); int num1, num0; num1 = num/10; num0 = num - num1*10; if (num1) { DGST_overlay(num1, dst); DGST_overlay(num0, dst+4); } else DGST_overlay(num0, dst); VP_xfer(50, VPCMD_W_DPCM, 0, VPDMA_USEDX, dst, 8, 16); VP_xfer_bf(0, VPCMD_R_DPCM, 0, VPDMA_BREAK+VPDMA_INC2+VPDMA_WIDTH1, top_left, 4, 16); VP_xfer_bf(0, VPCMD_R_DPCM, 8, VPDMA_BREAK+VPDMA_INC2+VPDMA_WIDTH1, top_left+3, 4, 16);} #else /* NEW_DIGEST_OSD *//************************************************************************ * Digest OSD. * Write a number at special position, number can not be larger than 99. ************************************************************************/PRIVATE void DGST_wr_num(num, fc, bkc, blend, frame) int num, fc, bkc, blend, frame;{ int offsetX,offsetY; int subnum,dnum;#if 1 int index = get_position_index();#else int index = num - 1;#endif subnum = num%10; dnum = num/10; if (DISP_scn_height==288) /* PAL ??? note: Y_PAL=Y_NTSC*6/5+4 */ offsetY=DGST_SUBSCRH*6/5*(((index)%9)/3)+DGST_FIRST_STARTY*6/5+8; else /*NTSC */ offsetY=DGST_SUBSCRH*(((index)%9)/3)+DGST_FIRST_STARTY; offsetX=DGST_FIRST_STARTX+(((index)%9)%3)*DGST_SUBSCRW; if (dnum){ DGST_wr_numxy(dnum, fc, bkc, blend, frame, offsetX, offsetY); offsetX += 12; /* move to next digital */ } DGST_wr_numxy(subnum, fc, bkc, blend, frame, offsetX, offsetY);} /************************************************************************ * Digest OSD. * Write a number at special position, notice: only one digital. ************************************************************************/PRIVATE void DGST_wr_numxy(num, fc, bkc, blend, frame, x, y) int num, fc, bkc, blend, frame, x, y;{ int mask,div; short i,j; int color; unsigned long * font = T_dgs_font; for (j=0;j<DGST_FHEIGHT;j++) { mask=0xc00000; div=0x400000; for (i=0;i<DGST_FWIDTH;i++) { switch ((int)(font[num*DGST_FHEIGHT+j]&mask)/div){ case 3: /* front color */ DISP_paint_dot(x+i,y+j,fc,blend,frame); break; #if 1 case 1: color=COLOR_BLUE; /* it is edge, color=blue */ DISP_paint_dot(x+i,y+j,color,blend,frame); break; #else case 0: /* background */ DISP_paint_dot(x+i,y+j,bkc,blend,frame); break; #endif } mask >>= 2; div >>= 2; } } } #endif /* NEW_DIGEST_OSD */#ifdef CUST4/************************************************************************ * Special feature STROBE 9 for Sony. ************************************************************************/void DGST_strobe9(void) { initDigest(); digest_track = 1; /* start at window 1 */ digest_mode = DIGEST_MOTION_MODE; digestAudioStart = 0; system_reset(); system_start(); /* currCDtime will be set to 0 if we start a new xport. In case we have * not got the new currCDtime, use stopCDtime. This will solve the * problem when switching between slow and strobe9 */ if (currCDtime == 0) currCDtime = stopCDtime; playSectors(currCDtime, 0xe0, 2324);}#endif /* CUST4 */#ifdef MOVING_DIGEST/************************************************************************ * Move digest window from "orig" to "dest". * Both "orig" and "dest" are digest window index defined in custdgt.h. * Return -1 if the input window index is out of range. ************************************************************************/int DGST_move_window(orig, dest)int orig, dest;{ DRAM_Addr from, to, bkgd; int i, j, width_Y, height_Y; /* * Check the input window index. */ if ((orig < 0) || (orig > 8) || (dest < 0) || (dest > 8)) return (-1); /* out of index range */ /* * Get the corresponding dram location according to * digest window index. */ get_dram_address(&from, orig); get_dram_address(&to, dest); get_dram_address(&bkgd, -1); /* get background address */ width_Y = subDigestXSpacing33; height_Y = subDigestYSpacing33; /* * Copy the corresponding Y, U and V. */ for (i = 0; i < width_Y; i++) { for (j = 0; j < height_Y; j++) { int addr = i + j*DMAWIDTH2_E2_UV*2; /* Y */ *(long *) dram(addr + to.start_Y) = *(long *) dram(addr + from.start_Y); *(long *) dram(addr + from.start_Y) = *(long *) dram(i + bkgd.start_Y); /* U and V */ if ((i < width_Y>>1) && (j < height_Y>>1)) { *(long *) dram(addr + to.start_U) = *(long *) dram(addr + from.start_U); *(long *) dram(addr + from.start_U) = *(long *) dram(i + bkgd.start_U); *(long *) dram(addr + to.start_V) = *(long *) dram(addr + from.start_V); *(long *) dram(addr + from.start_V) = *(long *) dram(i + bkgd.start_V); } } } return (0); /* done */}/************************************************************************ * Get the starting dram address of Y, U and V according to digest * window index. Index == -1 means background. ************************************************************************/PRIVATE void get_dram_address(ptr, index)DRAM_Addr *ptr;int index;{ DISP_Info *dip = DISP_info + 3; /* e2 frame */ int x, y, offset, y_offset, uv_offset; if (index >= 0) { x = xoffset33_Y(index); /* x coordinate in unit of DWORD */ y = yoffset33_Y(index); /* y coordinate (number of lines) */ /* * For PAL source and NTSC display in digest mode, we cropped * the first 2 macroblock rows for each digest picture. So we * have to advance the y coordinate by 16 (32/2 lines) in order * to get the ture starting dram addresses. */ if (vcx_VertSz > vcx_scn_height) y += 16; } else { /* background */ x = xoffset33_Y(1); y = yoffset33_Y(1) - 20; } /* * Convert to linear addresses for Y and UV. */ offset = y * DMAWIDTH2_E2_UV; y_offset = x + (offset<<1); uv_offset = (x>>1) + offset; /* * Obtain the starting Y, U and V addresses based on * the addresses in DISP_info for e2 offset by (x,y) * location. */ ptr->start_Y = dip->startY + y_offset; ptr->start_U = dip->startU + uv_offset; ptr->start_V = dip->startV + uv_offset;}#endif /* MOVING_DIGEST */#endif /* DIGEST */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -