diff options
| author | Ed Tanous <ed.tanous@intel.com> | 2017-04-18 13:41:22 -0700 |
|---|---|---|
| committer | Ed Tanous <ed.tanous@intel.com> | 2017-04-18 13:41:22 -0700 |
| commit | d5f3999491cb03ec7ec9aa461f39f10a0de21bba (patch) | |
| tree | 5bf08b986be3aca5d7a59cd08a379c94df204f36 /include | |
| parent | 1ff48780d3e8e4bc0dee01ae0e756eb4d46a4f53 (diff) | |
| download | bmcweb-d5f3999491cb03ec7ec9aa461f39f10a0de21bba.tar.gz bmcweb-d5f3999491cb03ec7ec9aa461f39f10a0de21bba.zip | |
test
Diffstat (limited to 'include')
| -rw-r--r-- | include/aspeed/JTABLES.H | 4 | ||||
| -rw-r--r-- | include/ast_jpeg_decoder.hpp | 143 | ||||
| -rw-r--r-- | include/ast_video_puller.hpp | 53 | ||||
| -rw-r--r-- | include/video.h | 378 | ||||
| -rw-r--r-- | include/web_kvm.hpp | 1 |
5 files changed, 124 insertions, 455 deletions
diff --git a/include/aspeed/JTABLES.H b/include/aspeed/JTABLES.H index 24e9c55..93fec8c 100644 --- a/include/aspeed/JTABLES.H +++ b/include/aspeed/JTABLES.H @@ -1,8 +1,4 @@ -#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
static unsigned char zigzag[64] = {
0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, 26, 29, 42,
3, 8, 12, 17, 25, 30, 41, 43, 9, 11, 18, 24, 31, 40, 44, 53,
diff --git a/include/ast_jpeg_decoder.hpp b/include/ast_jpeg_decoder.hpp index e7b36dc..2e0a9b6 100644 --- a/include/ast_jpeg_decoder.hpp +++ b/include/ast_jpeg_decoder.hpp @@ -6,8 +6,11 @@ #include <cassert> #include <cstdint> #include <iostream> +#include <string.h> #include <vector> +#include <g3log/g3log.hpp> +/* template <class T, class Compare> constexpr const T &clamp(const T &v, const T &lo, const T &hi, Compare comp) { return assert(!comp(hi, lo)), comp(v, lo) ? lo : comp(hi, v) ? hi : v; @@ -17,10 +20,20 @@ template <class T> constexpr const T &clamp(const T &v, const T &lo, const T &hi) { return clamp(v, lo, hi, std::less<>()); } - +*/ namespace AstVideo { struct COLOR_CACHE { + COLOR_CACHE() { + for (int i = 0; i < 4; i++) { + Index[i] = i; + } + Color[0] = 0x008080; + Color[1] = 0xFF8080; + Color[2] = 0x808080; + Color[3] = 0xC08080; + } + unsigned long Color[4]; unsigned char Index[4]; unsigned char BitMapBits; @@ -68,6 +81,13 @@ class AstJpegDecoder { r.B = 0x00; r.Reserved = 0xAA; } + + int qfactor = 16; + + SCALEFACTOR = qfactor; + SCALEFACTORUV = qfactor; + ADVANCESCALEFACTOR = 16; + ADVANCESCALEFACTORUV = 16; init_jpg_table(); } @@ -540,9 +560,9 @@ class AstJpegDecoder { pYUV[n].B = cb; pYUV[n].G = y; pYUV[n].R = cr; - pByte[n].B = clamp(m_Y[y] + m_CbToB[cb], 0, 0xFF); - pByte[n].G = clamp(m_Y[y] + m_CbToG[cb] + m_CrToG[cr], 0, 0xFF); - pByte[n].R = clamp(m_Y[y] + m_CrToR[cr], 0, 0xFF); + pByte[n].B = rlimit_table[m_Y[y] + m_CbToB[cb]]; + pByte[n].G = rlimit_table[m_Y[y] + m_CbToG[cb] + m_CrToG[cr]]; + pByte[n].R = rlimit_table[m_Y[y] + m_CrToR[cr]]; } pos += WIDTH; } @@ -563,9 +583,10 @@ class AstJpegDecoder { cb = pcb[m]; cr = pcr[m]; n = pos + i; - pByte[n].B = clamp(m_Y[y] + m_CbToB[cb], 0, 0xFF); - pByte[n].G = clamp(m_Y[y] + m_CbToG[cb] + m_CrToG[cr], 0, 0xFF); - pByte[n].R = clamp(m_Y[y] + m_CrToR[cr], 0, 0xFF); + pByte[n].B = rlimit_table[m_Y[y] + m_CbToB[cb]]; + pByte[n].G = rlimit_table[m_Y[y] + m_CbToG[cb] + m_CrToG[cr]]; + pByte[n].R = rlimit_table[m_Y[y] + m_CrToR[cr]]; + } pos += WIDTH; } @@ -607,9 +628,10 @@ class AstJpegDecoder { pYUV[n].B = cb; pYUV[n].G = y; pYUV[n].R = cr; - pByte[n].B = clamp(m_Y[y] + m_CbToB[cb], 0, 0xFF); - pByte[n].G = clamp(m_Y[y] + m_CbToG[cb] + m_CrToG[cr], 0, 0xFF); - pByte[n].R = clamp(m_Y[y] + m_CrToR[cr], 0, 0xFF); + pByte[n].B = rlimit_table[m_Y[y] + m_CbToB[cb]]; + pByte[n].G = rlimit_table[m_Y[y] + m_CbToG[cb] + m_CrToG[cr]]; + pByte[n].R = rlimit_table[m_Y[y] + m_CrToR[cr]]; + } pos += WIDTH; } @@ -630,9 +652,10 @@ class AstJpegDecoder { cb = pcb[m]; cr = pcr[m]; n = pos + i; - pByte[n].B = clamp(m_Y[y] + m_CbToB[cb], 0, 0xFF); - pByte[n].G = clamp(m_Y[y] + m_CbToG[cb] + m_CrToG[cr], 0, 0xFF); - pByte[n].R = clamp(m_Y[y] + m_CrToR[cr], 0, 0xFF); + pByte[n].B = rlimit_table[m_Y[y] + m_CbToB[cb]]; + pByte[n].G = rlimit_table[m_Y[y] + m_CbToG[cb] + m_CrToG[cr]]; + pByte[n].R = rlimit_table[m_Y[y] + m_CrToR[cr]]; + } pos += WIDTH; } @@ -749,18 +772,6 @@ class AstJpegDecoder { } } - void VQ_Initialize(struct COLOR_CACHE *VQ) { - int i; - - for (i = 0; i < 4; i++) { - VQ->Index[i] = i; - } - VQ->Color[0] = 0x008080; - VQ->Color[1] = 0xFF8080; - VQ->Color[2] = 0x808080; - VQ->Color[3] = 0xC08080; - } - void Init_Color_Table() { int i, x; int nScale = 1L << 16; // equal to power(2,16) @@ -1029,57 +1040,46 @@ class AstJpegDecoder { uint32_t decode(std::vector<uint32_t> &buffer, unsigned long width, unsigned long height, YuvMode yuvmode_in, int y_selector, int uv_selector) { - uint32_t i; COLOR_CACHE Decode_Color; - if (width != WIDTH || height != HEIGHT || yuvmode_in != yuvmode || + // If any of our parameters have changed, we need to reinit the jpeg + // Tables + if (width != USER_WIDTH || height != USER_HEIGHT || yuvmode_in != yuvmode || y_selector != Y_selector || uv_selector != UV_selector) { + LOG(DEBUG) << "Reinitializing\n"; init_JPG_decoding(); - } + USER_WIDTH = width; + USER_HEIGHT = height; - // TODO(ed) use the enum everywhere, not just externally - yuvmode = yuvmode_in; // 0 = YUV444, 1 = YUV420 - Y_selector = y_selector; // 0-7 - UV_selector = uv_selector; // 0-7 + yuvmode = yuvmode_in; // 0 = YUV444, 1 = YUV420 - // TODO(ed) Magic number section. Document appropriately - advance_selector = 0; // 0-7 - Mapping = 0; // 0 or 1 + // TODO(ed) Magic number section. Document appropriately + Y_selector = y_selector; // 0-7 + UV_selector = uv_selector; // 0-7 - WIDTH = width; - HEIGHT = height; + advance_selector = 0; // 0-7 + Mapping = 0; // 0 or 1 - VQ_Initialize(&Decode_Color); - // OutputDebugString ("In decode\n"); - // GetINFData (VideoEngineInfo); - // AST2000 JPEG block is 16x16(pixels) base + WIDTH = width; + HEIGHT = height; - if (yuvmode == YuvMode::YUV420) { - auto remainder = WIDTH % 16; - if (WIDTH % 16) { - WIDTH = WIDTH + 16 - remainder; + int block_size = 8; /// YUV444 has a block size of 8 + if (yuvmode == YuvMode::YUV420) { + block_size = 16; } - remainder = HEIGHT % 16; - if (remainder) { - HEIGHT = HEIGHT + 16 - remainder; - } - } else { - if (WIDTH % 8) { - WIDTH = WIDTH + 8 - (WIDTH % 8); + + auto remainder = WIDTH % block_size; + if (WIDTH % block_size) { + WIDTH = WIDTH + block_size - remainder; } - if (HEIGHT % 8) { - HEIGHT = HEIGHT + 8 - (HEIGHT % 8); + remainder = HEIGHT % block_size; + if (remainder) { + HEIGHT = HEIGHT + block_size - remainder; } } - int qfactor = 16; - - SCALEFACTOR = qfactor; - SCALEFACTORUV = qfactor; - ADVANCESCALEFACTOR = 16; - ADVANCESCALEFACTORUV = 16; - - // TODO(ed) cleanup cruft + LOG(DEBUG) << "Height" << HEIGHT << " WIDTH " << WIDTH << "\n"; + // TODO(ed) cleanup cruft. THis global buffer pointer is ugly and error prone Buffer = buffer.data(); codebuf = buffer[0]; @@ -1126,7 +1126,7 @@ class AstJpegDecoder { buffer); Decode_Color.BitMapBits = 0; - for (i = 0; i < 1; i++) { + for (int i = 0; i < 1; i++) { Decode_Color.Index[i] = ((codebuf >> 29) & VQ_INDEX_MASK); if (((codebuf >> 31) & VQ_HEADER_MASK) == VQ_NO_UPDATE_HEADER) { updatereadbuf(&codebuf, &newbuf, VQ_NO_UPDATE_LENGTH, &newbits, @@ -1148,7 +1148,7 @@ class AstJpegDecoder { buffer); Decode_Color.BitMapBits = 0; - for (i = 0; i < 1; i++) { + for (int i = 0; i < 1; i++) { Decode_Color.Index[i] = ((codebuf >> 29) & VQ_INDEX_MASK); if (((codebuf >> 31) & VQ_HEADER_MASK) == VQ_NO_UPDATE_HEADER) { updatereadbuf(&codebuf, &newbuf, VQ_NO_UPDATE_LENGTH, &newbits, @@ -1168,7 +1168,7 @@ class AstJpegDecoder { buffer); Decode_Color.BitMapBits = 1; - for (i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) { Decode_Color.Index[i] = ((codebuf >> 29) & VQ_INDEX_MASK); if (((codebuf >> 31) & VQ_HEADER_MASK) == VQ_NO_UPDATE_HEADER) { updatereadbuf(&codebuf, &newbuf, VQ_NO_UPDATE_LENGTH, &newbits, @@ -1190,7 +1190,7 @@ class AstJpegDecoder { buffer); Decode_Color.BitMapBits = 1; - for (i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) { Decode_Color.Index[i] = ((codebuf >> 29) & VQ_INDEX_MASK); if (((codebuf >> 31) & VQ_HEADER_MASK) == VQ_NO_UPDATE_HEADER) { updatereadbuf(&codebuf, &newbuf, VQ_NO_UPDATE_LENGTH, &newbits, @@ -1210,7 +1210,7 @@ class AstJpegDecoder { buffer); Decode_Color.BitMapBits = 2; - for (i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { Decode_Color.Index[i] = ((codebuf >> 29) & VQ_INDEX_MASK); if (((codebuf >> 31) & VQ_HEADER_MASK) == VQ_NO_UPDATE_HEADER) { updatereadbuf(&codebuf, &newbuf, VQ_NO_UPDATE_LENGTH, &newbits, @@ -1234,7 +1234,7 @@ class AstJpegDecoder { buffer); Decode_Color.BitMapBits = 2; - for (i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { Decode_Color.Index[i] = ((codebuf >> 29) & VQ_INDEX_MASK); if (((codebuf >> 31) & VQ_HEADER_MASK) == VQ_NO_UPDATE_HEADER) { updatereadbuf(&codebuf, &newbuf, VQ_NO_UPDATE_LENGTH, &newbits, @@ -1290,6 +1290,8 @@ class AstJpegDecoder { // WIDTH and HEIGHT are the modes your display used unsigned long WIDTH; unsigned long HEIGHT; + unsigned long USER_WIDTH; + unsigned long USER_HEIGHT; unsigned char Y_selector; int SCALEFACTOR; int SCALEFACTORUV; @@ -1326,11 +1328,12 @@ class AstJpegDecoder { uint8_t YDC_nr = 0, CbDC_nr = 1, CrDC_nr = 1; // AC Huffman table number for Y,Cb, Cr uint8_t YAC_nr = 0, CbAC_nr = 1, CrAC_nr = 1; - int txb, tyb; + int txb = 0; + int tyb = 0; int newbits; uint8_t *rlimit_table; std::vector<RGB> YUVBuffer; - // TODO(ed) this shouldn't exist. It is cruft that needs cleaning up' + // TODO(ed) this shouldn't exist. It is cruft that needs cleaning up uint32_t *Buffer; public: diff --git a/include/ast_video_puller.hpp b/include/ast_video_puller.hpp index d1ba3d5..de75fdf 100644 --- a/include/ast_video_puller.hpp +++ b/include/ast_video_puller.hpp @@ -1,13 +1,63 @@ #pragma once #include <assert.h> -#include <video.h> +//#include <video.h> #include <ast_video_types.hpp> #include <iostream> #include <vector> namespace AstVideo { class VideoPuller { + // + // Cursor struct is used in User Mode + // + typedef struct _cursor_attribution_tag { + unsigned int posX; + unsigned int posY; + unsigned int cur_width; + unsigned int cur_height; + unsigned int cur_type; // 0:mono 1:color 2:disappear cursor + unsigned int cur_change_flag; + } AST_CUR_ATTRIBUTION_TAG; + + // + // For storing Cursor Information + // + typedef struct _cursor_tag { + AST_CUR_ATTRIBUTION_TAG attr; + // unsigned char icon[MAX_CUR_OFFSETX*MAX_CUR_OFFSETY*2]; + unsigned char *icon; //[64*64*2]; + } AST_CURSOR_TAG; + + // + // For select image format, i.e. 422 JPG420, 444 JPG444, lumin/chrom table, 0 + // ~ 11, low to high + // + typedef struct _video_features { + short jpg_fmt; // 422:JPG420, 444:JPG444 + short lumin_tbl; + short chrom_tbl; + short tolerance_noise; + int w; + int h; + unsigned char *buf; + } FEATURES_TAG; + + // + // For configure video engine control registers + // + typedef struct _image_info { + short do_image_refresh; // Action 0:motion 1:fullframe 2:quick cursor + char qc_valid; // quick cursor enable/disable + unsigned int len; + int crypttype; + char cryptkey[16]; + union { + FEATURES_TAG features; + AST_CURSOR_TAG cursor_info; + } parameter; + } IMAGE_INFO; + public: VideoPuller() : image_info(){}; @@ -26,7 +76,6 @@ class VideoPuller { assert(video_fd != 0); RawVideoBuffer raw; - IMAGE_INFO image_info{}; image_info.do_image_refresh = 1; // full frame refresh image_info.qc_valid = 0; // quick cursor disabled image_info.parameter.features.w = 0; diff --git a/include/video.h b/include/video.h deleted file mode 100644 index 7662c9c..0000000 --- a/include/video.h +++ /dev/null @@ -1,378 +0,0 @@ -/* -* The definition and structure for AST 2500 Video Capture Driver -* Portions Copyright (C) 2015 Insyde Software Corp. -* -* This program is free software; you can redistribute it and/or modify it -* under the terms and conditions of the GNU General Public License, -* version 2, as published by the Free Software Foundation. -* -* This program is distributed in the hope 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. -*/ - -#ifndef _VIDEO_H_ -#define _VIDEO_H_ - -#define DEF_Y_TBL 4 -#define DEF_UV_TBL (7 | 0x10) - -#define VIDEO_IOC_MAGIC 'i' -#define VIDIOCMCAPTURE _IOW(VIDEO_IOC_MAGIC, 1, struct video_mmap*) -#define VIDIOCGFBUF _IOR(VIDEO_IOC_MAGIC, 2, struct video_buffer*) -#define VIDIOCCAPTURE _IOW(VIDEO_IOC_MAGIC, 3, unsigned long ) -#define VIDIOCGCAPTURE _IOR(VIDEO_IOC_MAGIC, 4, subcapture_info*) -#define VIDIOCSCAPTURE _IOW(VIDEO_IOC_MAGIC, 5, subcapture_info*) -#define VIDIOCGSEQ _IOR(VIDEO_IOC_MAGIC, 6, vseq_info*) -#define VIDIOCSSEQ _IOW(VIDEO_IOC_MAGIC, 7, vseq_info*) -#define VIDIOCGVIN _IOR(VIDEO_IOC_MAGIC, 8, vin_info*) -#define VIDIOCSVIN _IOW(VIDEO_IOC_MAGIC, 9, vin_info*) -#define VIDIOCGPROC _IOR(VIDEO_IOC_MAGIC, 10, vproc_info*) -#define VIDIOCSPROC _IOW(VIDEO_IOC_MAGIC, 11, vproc_info*) -#define VIDIOCGCOMP _IOR(VIDEO_IOC_MAGIC, 12, vcomp_info*) -#define VIDIOCSCOMP _IOW(VIDEO_IOC_MAGIC, 13, vcomp_info*) -#define VIDIOCDBG _IOR(VIDEO_IOC_MAGIC, 14, unsigned int*) -#define VIDIOCIMGREFRESH _IOW(VIDEO_IOC_MAGIC, 15, unsigned int*) - -#define VIDEO_IOC_MAXNR 15 - -#define DUAL_COMP_BUFFER -#define V_MASK - -#define AST2500_DEVICEID 0x25032402 -#define AST2400_DEVICEID 0x00002402 - -// FLAG_FRAME_SIZE = (x/8) * (y/8) * 4 -// 144K:(1920/8)*(1200/8)*4 (current set 1M) -#define FLAG_FRAME_SIZE 0x100000 // 1*1024*1024 -// PROC_FRAME_SIZE = X * Y * 4 -// 9M:1920*1200*4, 8M:1600*1200*4, 5M:1280*1024*4, 3M:1024*768*4 -#define PROC_FRAME_SIZE 0x900000 // 9*1024*1024 -// According to VREG(VR_STREAM_BUF_SZ) Video Stream Buffer Size Register -// bit[2:0] = 7 (128KB), bit[4:3] = 3 (32 packets), So max compression data -// will be 128KB * 32 = 4 MB, -// 4M: (128*1024)*32 -#define COMP_FRAME_SIZE 0x400000 // 4*1024*1024 -// Total Video Mem Buffer Size -// 2 PROC + 2 COMP + 1 FLAG for Capture Eng, 1 PROC + 1 COMP + 1 FLAG for Jpeg Capture Eng -#define VIDEO_MEM_BUF_SIZE 0x2900000 -// Define Video Memory Start Address According to Memory & Kernel Size -// Total:128M, 80M for Kernel -#define SDRAM_MEM_OFFSET_ADDR 0x80000000 - -#define SYS_MEM_SZ_128M 0 -#define SYS_MEM_SZ_256M 1 -#define SYS_MEM_SZ_512M 2 -#define SYS_MEM_SZ_1024M 3 - -#define V_MEM_SZ_8M 0 -#define V_MEM_SZ_16M 1 -#define V_MEM_SZ_32M 2 -#define V_MEM_SZ_64M 3 - -#define MODE_DETECT 0 -#define MODE_CHANGE 1 -#define MAX_NO_SYNC_CNT 100 -#define V_BUSY_TIME_OUT 6 //time tick - -// Register Offset -#define SDRAM_PHY_BASE 0x1E6E0000 //1E6E:0000-1E6E:1FFF -#define SCU_PHY_BASE 0x1E6E2000 //1E6E:2000-1E6E:2FFF -#define VIDEO_PHY_BASE 0x1E700000 //1E70:0000-1E7F:FFFF - -// IRQ NUMBER -#define VIDEO_IRQ 7 // for video -#define CURSOR_IRQ 21 // for quick cursor - -// Register Definition -#define VREG(x) (*(volatile unsigned int *)(IO_ADDRESS(x + VIDEO_PHY_BASE))) -#define SDRAMREG(x) (*(volatile unsigned int *)(IO_ADDRESS(x + SDRAM_PHY_BASE))) -#define SCUREG(x) (*(volatile unsigned int *)(IO_ADDRESS(x + SCU_PHY_BASE))) - -// Register Protection Key -#define SCU_UNLOCK_KEY 0x1688A8A8 -#define MCR_UNLOCK_KEY 0xFC600309 -#define VR_UNLOCK_KEY 0x1A038AA8 - -// SDRAM Memory Controller Register Offset -#define MCR_PROTECTION_KEY 0x000 -#define MCR_CONFIGURATION 0x004 -#define BACKWARD_SCU_MPLL 0x120 - -// System Control Unit Register Offset -#define SCU_PROTECTION_KEY 0x00 -#define SCU_SYSTEM_RESET_CTL 0x04 -#define SCU_CLOCK_SELECTION 0x08 -#define SCU_CLK_STOP_CTL 0x0C -#define SCU_INTERRUPT_CTL 0x18 -#define SCU_MPLL_PARAMETER 0x20 -#define SCU_MISC1_CTL 0x2C -#define SCU_SOC_SCRATCH1 0x40 -#define SCU_VGA_SCRATCH1 0x50 -#define SCU_VGA_SCRATCH2 0x54 -#define SCU_HW_STRAPPING 0x70 -#define SCU_SILICON_REV_ID 0x7C -#define SCU_DEVICE_ID 0x1A4 - -// Video Register Offset -#define VR_PROTECT_KEY 0x000 -#define VIDEO_SEQ_CTL 0x004 -#define VIDEO_PASS1_CTL 0x008 -#define TIMING_GEN_SETTING1 0x00C // if VIDEO_CTL1[5] = 0 -#define TIMING_GEN_SETTING2 0x010 // if VIDEO_CTL1[5] = 0 -#define SCALING_FACTOR 0x014 -#define SCALING_FILTER_PARAMETER0 0x018 -#define SCALING_FILTER_PARAMETER1 0x01C -#define SCALING_FILTER_PARAMETER2 0x020 -#define SCALING_FILTER_PARAMETER3 0x024 -#define BCD_CTL 0x02C -#define CAPTURING_WINDOW_SETTING 0x030 -#define COMP_WINDOW_SETTING 0x034 -#define COMP_STREAM_BUF_PROC_OFFSET 0x038 -#define COMP_STREAM_BUF_READ_OFFSET 0x03C -#define CRC_BUF_BASE_ADDR 0x040 -#define VIDEO_SOURCE_BUF1_BASE_ADDR 0x044 -#define SOURCE_BUF_SCANLINE_OFFSET 0x048 -#define VIDEO_SOURCE_BUF2_BASE_ADDR 0x04C -#define BCD_FLAG_BUF_BASE_ADDR 0x050 -#define COMP_STREAM_BUF_BASE_ADDR 0x054 -#define VIDEO_STREAM_BUF_SIZE 0x058 -#define COMP_STREAM_BUF_WRITE_OFFSET 0x05C -#define VIDEO_COMP_CTL 0x060 -#define JPEG_BIT_CTRL 0x064 -#define QUANTIZATION_VALUE 0x068 -#define COPY_BUF_BASE_ADDR 0x06C -#define COMP_STREAM_SIZE 0x070 -#define COMP_BLOCK_NUM 0x074 -#define COMP_STREAM_BUF_END_OFFSET 0x078 -#define COMP_FRAME_COUNTER 0x07C -#define USER_HDR_PARAM 0x080 -#define SOURCE_L_R_EDGE_DETECT 0x090 -#define SOURCE_T_B_EDGE_DETECT 0x094 -#define MODE_DETECT_STATUS 0x098 - -/* Video Management Engine, i.e. 2nd Set Video Engine */ -#define VM_SEQ_CTRL 0x204 -#define VM_PASS_CTRL 0x208 -#define VM_SCALING_FACTOR 0x214 -#define VM_CAP_WINDOW_SETTING 0x230 -#define VM_COMP_WINDOW_SETTING 0x234 -#define VM_COMP_BUF_PROC_OFFSET 0x238 -#define VM_COMP_BUF_READ_OFFSET 0x23C -#define VM_JPEG_HEADER_BUFF 0x240 -#define VM_SOURCE_BUFF0 0x244 -#define VM_SRC_BUF_SCANLINE_OFFSET 0x248 -#define VM_COMPRESS_BUFF 0x254 -#define VM_STREAM_SIZE 0x258 -#define VM_COMPRESS_CTRL 0x260 -#define VM_JPEG_BIT_CTRL 0x264 -#define VM_QUANTIZATION_VALUE 0x268 -#define VM_COPY_BUF_BASE_ADDR 0x26C -#define VM_COMP_STREAM_SIZE 0x070 -#define VM_COMP_BLOCK_NUM 0x074 -#define VM_COMP_STREAM_BUF_END_OFFSET 0x278 -#define VM_USER_HDR_PARAM 0x280 - -#define VIDEO_PASS3_CTRL 0x300 -#define INTERRUPT_CTL 0x304 -#define INTERRUPT_STATUS 0x308 -#define MODE_DETECT_PARAMETER 0x30C -#define MEM_RESTRICT_START_ADDR 0x310 -#define MEM_RESTRICT_END_ADDR 0x314 -#define PRI_CRC_PARAMETER 0x320 -#define SEC_CRC_PARAMETER 0x324 -#define DATA_TRUNCATION 0x328 -#define VGA_SCRATCH_REMAP1 0x340 -#define VGA_SCRATCH_REMAP2 0x344 -#define VGA_SCRATCH_REMAP3 0x348 -#define VGA_SCRATCH_REMAP4 0x34C -#define VGA_SCRATCH_REMAP5 0x350 -#define VGA_SCRATCH_REMAP6 0x354 -#define VGA_SCRATCH_REMAP7 0x358 -#define VGA_SCRATCH_REMAP8 0x35C -#define RC4KEYS_REGISTER 0x400 //0x400~0x4FC RC4 Encryption Key Register #0~#63 - -// -// Cursor struct is used in User Mode -// -typedef struct _cursor_attribution_tag { - unsigned int posX; - unsigned int posY; - unsigned int cur_width; - unsigned int cur_height; - unsigned int cur_type; //0:mono 1:color 2:disappear cursor - unsigned int cur_change_flag; -} AST_CUR_ATTRIBUTION_TAG; - -// -// For storing Cursor Information -// -typedef struct _cursor_tag { - AST_CUR_ATTRIBUTION_TAG attr; - //unsigned char icon[MAX_CUR_OFFSETX*MAX_CUR_OFFSETY*2]; - unsigned char *icon; //[64*64*2]; -} AST_CURSOR_TAG; - -// -// For select image format, i.e. 422 JPG420, 444 JPG444, lumin/chrom table, 0 ~ 11, low to high -// -typedef struct _video_features { - short jpg_fmt; //422:JPG420, 444:JPG444 - short lumin_tbl; - short chrom_tbl; - short tolerance_noise; - int w; - int h; - unsigned char *buf; -} FEATURES_TAG; - -// -// For configure video engine control registers -// -typedef struct _image_info { - short do_image_refresh; // Action 0:motion 1:fullframe 2:quick cursor - char qc_valid; // quick cursor enable/disable - unsigned int len; - int crypttype; - char cryptkey[16]; - union { - FEATURES_TAG features; - AST_CURSOR_TAG cursor_info; - } parameter; -} IMAGE_INFO; - -typedef struct _video_set_chk { - short get_qc_info; // Quick Cursor Info - short do_image_refresh; - FEATURES_TAG features; -} video_set_chk; - -struct video_buffer { - void *base; - int height, width; - int depth; - int bytesperline; -}; - -// -// Data Structure for Video Buffer Layout -// kept information about video buffer layout, used in memory initialization. -// -typedef struct _buf_layout { - int c_proc; - int c_comp; - unsigned int in; // video in buffer - unsigned int proc [2]; // old and current proc buffer - unsigned int comp [2]; // compressed data buffer - unsigned int flag; // flag buffer - unsigned int jpgproc; // old and current proc buffer for jpeg - unsigned int jpgcomp; // compressed data buffer for jpeg - unsigned int jpgflag; // flag buffer for jpeg -} buf_layout; - -// -// subcapture_info: -// linestep - byte per line after scaling, but 32 byte align -// step - scaling step, decrease 8 pixels a step after scaling. -// scaled_h - height after scaling. -// scaled_w - width after scaling. -// hor_factor, ver_factor - horizontal and vertical scaling factor -// init - initialized = 0, not initialized = 1, set by mode_detect -// -typedef struct _subcature_info { - int linestep; - short x, y, width, height, scaled_h, scaled_w; - unsigned short hor_factor, ver_factor; - short step, init; -} subcapture_info; - -// -// video_hw_info: -// cap_seq - capture orders, CAP_PASSX and CAP_INIT_FRAME -// cap_int - interrupt to enable -// cur_idx - current idx of resolution table content. -// -// mode_change must be -// set by interrupt handler, and clear -// when capture start. -// - -//FK Comment : -//interrupt handler for mode_chage -//capture start, mode_chage, clear -//cur_idx resolution state, Ex: 800x600 80Hz, ... -//cap_int interrupt enable -//cap_seq captor orders i.e. CAP_PASS1, CAP_PASS2..., or CAP_INIT_FRAME -#define MCAP_FRAME 2 -typedef struct _mcap_info { - int offset; - int size; -} mcap_info; - -typedef struct _video_hw_info { - int cap_seq; - mcap_info mcap [MCAP_FRAME]; // record each frame size of mcapture - //volatile short width, height, fix_x, fix_y, cur_idx; - short width, height, fix_x, fix_y, cur_idx; - short max_h, max_w, min_h, min_w; - short cap_int; - - char mode_changed; //1130 modify - //volatile char mode_changed; //1130 modify - char cap_done, capturing, disconnect; //, mode_changed; //, cur_idx; - char can_capture; // prevent hardware error. - subcapture_info subcap; -// VIDEO_ENGINE_INFO ve_info; -} video_hw_info; - -struct video_mmap { - unsigned int frame; // Frame (0 - n) for double buffer - int height, width; - unsigned int format; // should be VIDEO_PALETTE_* -}; - -// Internal_Mode Table for resolution checking -typedef struct { - unsigned short HorizontalActive; - unsigned short VerticalActive; - unsigned short RefreshRateIndex; - unsigned int PixelClock; -} INTERNAL_MODE; - -INTERNAL_MODE Internal_Mode [] = { - // 1024x768 - { 1024, 768, 0, 65 }, - { 1024, 768, 1, 65 }, - { 1024, 768, 2, 75 }, - { 1024, 768, 3, 79 }, - { 1024, 768, 4, 95 }, - - // 1280x1024 - { 1280, 1024, 0, 108 }, - { 1280, 1024, 1, 108 }, - { 1280, 1024, 2, 135 }, - { 1280, 1024, 3, 158 }, - - // 1600x1200 - { 1600, 1200, 0, 162 }, - { 1600, 1200, 1, 162 }, - { 1600, 1200, 2, 176 }, - { 1600, 1200, 3, 189 }, - { 1600, 1200, 4, 203 }, - { 1600, 1200, 5, 230 }, - - // 1920x1200 reduce blank - { 1920, 1200, 0, 157 }, - { 1920, 1200, 1, 157 }, -}; - -typedef enum vga_color_mode { - VGA_NO_SIGNAL = 0, - EGA_MODE, - VGA_MODE, - VGA_15BPP_MODE, - VGA_16BPP_MODE, - VGA_32BPP_MODE, -} color_mode; -#endif //_VIDEO_H_ diff --git a/include/web_kvm.hpp b/include/web_kvm.hpp index e558623..2512570 100644 --- a/include/web_kvm.hpp +++ b/include/web_kvm.hpp @@ -4,7 +4,6 @@ #include <ast_jpeg_decoder.hpp> #include <ast_video_puller.hpp> -#include <video.h> namespace crow { namespace kvm { |

