static inline int fcc_cr_cmd(struct fs_enet_private *fep, u32 mcn, u32 op) { const struct fs_platform_info *fpi = fep->fpi; cpm2_map_t *immap = fs_enet_immap; cpm_cpm2_t *cpmp = &immap->im_cpm; u32 v; int i; /* Currently I don't know what feature call will look like. But I guess there'd be something like do_cpm_cmd() which will require page & sblock */ v = mk_cr_cmd(fpi->cp_page, fpi->cp_block, mcn, op); W32(cpmp, cp_cpcr, v | CPM_CR_FLG); for (i = 0; i < MAX_CR_CMD_LOOPS; i++) if ((R32(cpmp, cp_cpcr) & CPM_CR_FLG) == 0) break; if (i >= MAX_CR_CMD_LOOPS) { printk(KERN_ERR "%s(): Not able to issue CPM command\n", __FUNCTION__); return 1; } return 0; }
inline void AlphaBlend( Uint32& p, int cr, int cg, int cb, int a, int ia ) { //888 p = R16G16B16_TO_RGB888( a * cr + ia * R32(p), a * cg + ia * G32(p), a * cb + ia * B32(p) ); }
void OnPaint(GSurface *pDC) { GRect r = GetClient(); LgiWideBorder(pDC, r, DefaultRaisedEdge); pDC->Colour(LC_MED, 24); pDC->Rectangle(&r); SysFont->Transparent(true); if (Colour->Presets.Length()) { char s[64]; SysFont->Colour(LC_BLACK, LC_MED); GDisplayString ds(SysFont, (char*)LgiLoadString(L_COLOUR_NONE, "No Colour")); ds.Draw(pDC, r.x1 + 2, r.y1 + 2); for (unsigned i=0; i<Colour->Presets.Length(); i++) { int y = r.y1 + ((i+1) * Ly); COLOUR p32 = Colour->Presets[i]; pDC->Colour(p32, 32); pDC->Rectangle(r.x1+1, y+1, r.x1+Ly-1, y+Ly-1); sprintf_s(s, sizeof(s), "%2.2X,%2.2X,%2.2X", R32(p32), G32(p32), B32(p32)); GDisplayString ds(SysFont, s); ds.Draw(pDC, r.x1 + Ly + 10, y + 2); } } }
static void pl192_begin_interrupt(phantom_device_t *dev) { u_int32_t isr_addr = R32( dev->iobase + VIC_REG_VECTOR_ADDR ); // ignored, this read is required to ack to hw that interrupt // is being services (void) isr_addr; }
// END MOD Feb 2005 by GMV uint8_t AviList::Write32(uint32_t val) { #ifdef ADM_BIG_ENDIAN val=R32(val); #endif _ff->write((uint8_t *)&val,4); return 1; }
void speck_encrypt32(SPECK_TYPE32 const pt[2], SPECK_TYPE32 ct[2], SPECK_TYPE32 const K[SPECK_ROUNDS32]) { SPECK_TYPE32 i; ct[0] = pt[0]; ct[1] = pt[1]; for (i = 0; i < SPECK_ROUNDS32; i++){ R32(ct[1], ct[0], K[i]); } }
static void set_multicast_finish(struct net_device *dev) { struct fs_enet_private *fep = netdev_priv(dev); fcc_t __iomem *fccp = fep->fcc.fccp; fcc_enet_t __iomem *ep = fep->fcc.ep; /* clear promiscuous always */ C32(fccp, fcc_fpsmr, FCC_PSMR_PRO); /* if all multi or too many multicasts; just enable all */ if ((dev->flags & IFF_ALLMULTI) != 0 || dev->mc_count > FCC_MAX_MULTICAST_ADDRS) { W32(ep, fen_gaddrh, 0xffffffff); W32(ep, fen_gaddrl, 0xffffffff); } /* read back */ fep->fcc.gaddrh = R32(ep, fen_gaddrh); fep->fcc.gaddrl = R32(ep, fen_gaddrl); }
static errno_t check_reg(int ioa, u_int32_t value) { u_int32_t r = R32(ioa); if( r != value ) { SHOW_ERROR( 0, "Reg %x != %x", ioa, value ); return ENXIO; } return 0; }
void speck_set_decrypt_key32(SPECK_TYPE32 const K[SPECK_KEY_LEN32], SPECK_TYPE32 S[SPECK_ROUNDS32]) { SPECK_TYPE32 i, b = K[0]; SPECK_TYPE32 a[SPECK_KEY_LEN32 - 1]; for (i = 0; i < (SPECK_KEY_LEN32 - 1); i++) { a[i] = K[i + 1]; } S[0] = b; for (i = 0; i < SPECK_ROUNDS32 - 1; i++) { R32(a[i % (SPECK_KEY_LEN32 - 1)], b, i); S[i + 1] = b; } }
// // Io stuff // uint8_t AviList::Write32(uint32_t val) { #ifdef ADM_BIG_ENDIAN val=R32(val); #endif if(! fwrite(&val, 4, 1, _ff)) { // //printf("\n Write error : %d",ferror(_ff)); } return 1; }
/* Some transmit errors cause the transmitter to shut * down. We now issue a restart transmit. * Also, to workaround 8260 device erratum CPM37, we must * disable and then re-enable the transmitterfollowing a * Late Collision, Underrun, or Retry Limit error. * In addition, tbptr may point beyond BDs beyond still marked * as ready due to internal pipelining, so we need to look back * through the BDs and adjust tbptr to point to the last BD * marked as ready. This may result in some buffers being * retransmitted. */ static void tx_restart(struct net_device *dev) { struct fs_enet_private *fep = netdev_priv(dev); fcc_t __iomem *fccp = fep->fcc.fccp; const struct fs_platform_info *fpi = fep->fpi; fcc_enet_t __iomem *ep = fep->fcc.ep; cbd_t __iomem *curr_tbptr; cbd_t __iomem *recheck_bd; cbd_t __iomem *prev_bd; cbd_t __iomem *last_tx_bd; last_tx_bd = fep->tx_bd_base + (fpi->tx_ring * sizeof(cbd_t)); /* get the current bd held in TBPTR and scan back from this point */ recheck_bd = curr_tbptr = (cbd_t __iomem *) ((R32(ep, fen_genfcc.fcc_tbptr) - fep->ring_mem_addr) + fep->ring_base); prev_bd = (recheck_bd == fep->tx_bd_base) ? last_tx_bd : recheck_bd - 1; /* Move through the bds in reverse, look for the earliest buffer * that is not ready. Adjust TBPTR to the following buffer */ while ((CBDR_SC(prev_bd) & BD_ENET_TX_READY) != 0) { /* Go back one buffer */ recheck_bd = prev_bd; /* update the previous buffer */ prev_bd = (prev_bd == fep->tx_bd_base) ? last_tx_bd : prev_bd - 1; /* We should never see all bds marked as ready, check anyway */ if (recheck_bd == curr_tbptr) break; } /* Now update the TBPTR and dirty flag to the current buffer */ W32(ep, fen_genfcc.fcc_tbptr, (uint) (((void *)recheck_bd - fep->ring_base) + fep->ring_mem_addr)); fep->dirty_tx = recheck_bd; C32(fccp, fcc_gfmr, FCC_GFMR_ENT); udelay(10); S32(fccp, fcc_gfmr, FCC_GFMR_ENT); fcc_cr_cmd(fep, CPM_CR_RESTART_TX); }
static errno_t check_pl192_sanity(int iobase) { u_int32_t id = R32(iobase+VIC_REG_HID0); if( (id & 0xFF) != 0x192 ) { SHOW_ERROR( 0, "Part number is %x", id & 0xFF ); return ENXIO; } SHOW_INFO( 1, "Id is %x", id ); check_reg(iobase+VIC_REG_PCELLID0, 0x0D ); check_reg(iobase+VIC_REG_PCELLID1, 0xF0 ); check_reg(iobase+VIC_REG_PCELLID2, 0x05 ); check_reg(iobase+VIC_REG_PCELLID3, 0xB1 ); return 0; }
void ExtractRgb( uint32 c, int& r, int &g, int &b ) { r = R32(c); g = G32(c); b = B32(c); }
void load_character(FILE *f, TBadGuy *b) { R32(b->armedBodyPic); R32(b->unarmedBodyPic); R32(b->facePic); R32(b->speed); R32(b->probabilityToMove); R32(b->probabilityToTrack); R32(b->probabilityToShoot); R32(b->actionDelay); R32(b->gun); R32(b->skinColor); R32(b->armColor); R32(b->bodyColor); R32(b->legColor); R32(b->hairColor); R32(b->health); R32(b->flags); }
static void load_mission(FILE *f, struct MissionOld *m) { int i; f_read(f, m->title, sizeof(m->title)); f_read(f, m->description, sizeof(m->description)); debug(D_NORMAL, "== MISSION ==\n"); debug(D_NORMAL, "t: %s\n", m->title); debug(D_NORMAL, "d: %s\n", m->description); R32(m->wallStyle); R32(m->floorStyle); R32(m->roomStyle); R32(m->exitStyle); R32(m->keyStyle); R32(m->doorStyle); R32(m->mapWidth); R32(m->mapHeight); R32(m->wallCount); R32(m->wallLength); R32(m->roomCount); R32(m->squareCount); R32(m->exitLeft); R32(m->exitTop); R32(m->exitRight); R32(m->exitBottom); R32(m->objectiveCount); debug(D_NORMAL, "number of objectives: %d\n", m->objectiveCount); for (i = 0; i < OBJECTIVE_MAX; i++) { load_mission_objective(f, &m->objectives[i]); } R32(m->baddieCount); for (i = 0; i < BADDIE_MAX; i++) { f_read32(f, &m->baddies[i], sizeof(int)); } R32(m->specialCount); for (i = 0; i < SPECIAL_MAX; i++) { f_read32(f, &m->specials[i], sizeof(int)); } R32(m->itemCount); for (i = 0; i < ITEMS_MAX; i++) { f_read32(f, &m->items[i], sizeof(int)); } for (i = 0; i < ITEMS_MAX; i++) { f_read32(f, &m->itemDensity[i], sizeof(int)); } R32(m->baddieDensity); R32(m->weaponSelection); f_read(f, m->song, sizeof(m->song)); f_read(f, m->map, sizeof(m->map)); R32(m->wallRange); R32(m->floorRange); R32(m->roomRange); R32(m->altRange); debug(D_VERBOSE, "number of baddies: %d\n", m->baddieCount); }
//________________________________________________ // Beginning of the write process // We fill-in the headers // 3- Write audio headers // That one can be used several times so we pass stuff // as parameter //_______________________________________________ uint8_t aviWrite::writeAudioHeader ( AVDMGenericAudioStream * stream, AVIStreamHeader *header ) { WAVHeader *wav=NULL; // pre compute some headers with extra data in... uint8_t wmaheader[12]; VBRext mp3vbr; uint8_t *extra=NULL; uint32_t extraLen=0; if(!stream) return 1; memset(wmaheader,0,12); memset(&mp3vbr,0,sizeof(mp3vbr)); wmaheader[16-16]=0x0a; wmaheader[19-16]=0x08; wmaheader[22-16]=0x01; wmaheader[24-16]=0x74; wmaheader[25-16]=01; wav = stream->getInfo (); assert (wav); memset (header, 0, sizeof (AVIStreamHeader)); header->fccType = fourCC::get ((uint8_t *) "auds"); header->dwInitialFrames = 0; header->dwStart = 0; header->dwRate = wav->byterate; header->dwSampleSize = 1; header->dwQuality = 0xffffffff; header->dwSuggestedBufferSize = 8000; header->dwLength = stream->getLength (); switch(wav->encoding) { case WAV_MP3: // then update VBR fields mp3vbr.cbsize = R16(12); mp3vbr.wId = R16(1); mp3vbr.fdwflags = R32(2); mp3vbr.nframesperblock = R16(1); mp3vbr.ncodecdelay = 0; wav->bitspersample = 0; mp3vbr.nblocksize=R16(0x180); //383; // ?? header->dwScale = 1; header->dwInitialFrames = 1; if (wav->blockalign ==1152) // VBR audio { // We do like nandub do //assert (audiostream->asTimeTrack ()); wav->blockalign = 1152; // just a try wav->bitspersample = 16; header->dwRate = wav->frequency; //wav->byterate; header->dwScale = wav->blockalign; header->dwLength= _videostream.dwLength; header->dwSampleSize = 0; printf ("\n VBR audio detected\n"); // // use extended headers // // double nb; nb = stream->getLength (); nb/= _videostream.dwLength; // avg value of a block (i.e. a mpeg frame) mp3vbr.nblocksize = (uint32_t) floor (nb); mp3vbr.nblocksize = R16(mp3vbr.nblocksize); } else wav->blockalign=1; extra=(uint8_t *)&mp3vbr; extraLen=sizeof(mp3vbr); break; case WAV_WMA: header->dwScale = wav->blockalign; header->dwSampleSize = wav->blockalign; header->dwInitialFrames =1; header->dwSuggestedBufferSize=10*wav->blockalign; extra=(uint8_t *)&wmaheader; extraLen=12; break; default: header->dwScale = 1; wav->blockalign=1; break; } #ifdef ADM_BIG_ENDIAN // in case of Little endian, do the usual swap crap AVIStreamHeader as; WAVHeader w; memcpy(&as,header,sizeof(as)); Endian_AviStreamHeader(&as); memcpy(&w,wav,sizeof(w)); Endian_WavHeader( &w ); setStreamInfo (_out, (uint8_t *) &as, (uint8_t *)&w,sizeof(WAVHeader), extra,extraLen, 0x1000); #else setStreamInfo (_out, (uint8_t *) header, (uint8_t *) wav, sizeof (WAVHeader), extra,extraLen, 0x1000); #endif return 1; }
/** \fn A_openAvi \brief Open (replace mode) a video */ int A_openAvi (const char *name) { uint8_t res; char *longname; uint32_t magic[4]; uint32_t id = 0; if (playing) return 0; /// check if name exists FILE *fd; fd = ADM_fopen(name, "rb"); if (!fd) { if (errno == EACCES) { GUI_Error_HIG(QT_TRANSLATE_NOOP("adm", "Permission error"), QT_TRANSLATE_NOOP("adm", "Cannot open \"%s\"."), name); } if (errno == ENOENT) { GUI_Error_HIG(QT_TRANSLATE_NOOP("adm", "File error"), QT_TRANSLATE_NOOP("adm", "\"%s\" does not exist."), name); } return 0; } if (4 == fread(magic, 4, 4, fd)) id = R32(magic[0]); fclose(fd); GUI_close(); // Cleanup // DIA_StartBusy (); /* ** we may get a relative path by cmdline */ longname = ADM_PathCanonize(name); // check if avisynth input is given if (fourCC::check(id, (uint8_t *) "ADAP")) res = video_body->addFile(AVS_PROXY_DUMMY_FILE); else res = video_body->addFile(longname); // DIA_StopBusy (); // forget last project file video_body->setProjectName(""); if (res != ADM_OK) // an error occured { delete[] longname; if (ADM_IGN == res) { return 0; } if (fourCC::check(id, (uint8_t *) "//AD")) { GUI_Error_HIG(QT_TRANSLATE_NOOP("adm", "Cannot open project using the video loader."), QT_TRANSLATE_NOOP("adm", "Try 'File' -> 'Load/Run Project...'")); } else { GUI_Error_HIG(QT_TRANSLATE_NOOP("adm", "Could not open the file"), NULL); } return 0; } { int i; FILE *fd = NULL; char magic[4]; /* check myself it is a project file (transparent detected and read ** by video_body->addFile (name); */ //#warning FIXME #if 0 if ((fd = ADM_fopen(longname, "rb"))) { if (fread(magic, 4, 1, fd) == 4) { /* remember a workbench file */ if (!strncmp(magic, "ADMW", 4)) { actual_workbench_file = ADM_strdup(longname); } } fclose(fd); } #endif /* remember any video or workbench file to "recent" */ prefs->set_lastfile(longname); UI_updateRecentMenu(); updateLoaded(); if (currentaudiostream) { uint32_t nbAudio; audioInfo *infos = NULL; if (video_body->getAudioStreamsInfo(admPreview::getCurrentPts() + 1, &nbAudio, &infos)) { if (nbAudio > 1) { // Multiple track warn user GUI_Info_HIG(ADM_LOG_INFO, QT_TRANSLATE_NOOP("adm", "Multiple Audio Tracks"), QT_TRANSLATE_NOOP("adm", "The file you just loaded contains several audio tracks.\n" "Go to Audio->MainTrack to select the active one.")); } } if (infos) delete [] infos; // Revert mixer to copy //setCurrentMixerFromString("NONE"); EditableAudioTrack *ed = video_body->getDefaultEditableAudioTrack(); if (ed) ed->audioEncodingConfig.audioFilterSetMixer(CHANNEL_INVALID); } for (i = strlen(longname); i >= 0; i--) { #ifdef _WIN32 if (longname[i] == '\\' || longname[i] == '/') #else if (longname[i] == '/') #endif { i++; break; } } UI_setTitle(longname + i); } delete[] longname; return 1; }
void load_character(FILE *f, TBadGuy *c) { R32(c, armedBodyPic); R32(c, unarmedBodyPic); R32(c, facePic); R32(c, speed); R32(c, probabilityToMove); R32(c, probabilityToTrack); R32(c, probabilityToShoot); R32(c, actionDelay); R32(c, gun); R32(c, skinColor); R32(c, armColor); R32(c, bodyColor); R32(c, legColor); R32(c, hairColor); R32(c, health); R32(c, flags); // fprintf(stderr, " speed: %d gun: %d\n", c->speed, c->gun); }
int JpegCompressor::compressRawImage(const void * image, int width, int height, int quality, int useEffect = 0) { void * src = const_cast<void *>(image); uint8_t *yp = static_cast<uint8_t *>(src); struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; JSAMPROW row_pointer[1]; uint8_t *line_buffer; int bufferlen = width*height<<1; line_buffer = (uint8_t*)calloc(width*3,1); mJpegBuffer = new uint8_t[bufferlen]; mJpegSize = 0; if(!line_buffer) { LOGE("@TEI compress_yuv_to_jpeg: line_buffer calloc failed!" ); return -1; } if (!mJpegBuffer) { free(line_buffer); return -1; } cinfo.err = jpeg_std_error (&jerr); jpeg_create_compress (&cinfo); jpeg_nf_stdio_dest(&cinfo,(char*)mJpegBuffer,&bufferlen ); cinfo.image_width = width; cinfo.image_height = height; cinfo.input_components = 3; cinfo.in_color_space = JCS_RGB; jpeg_set_defaults (&cinfo); jpeg_set_quality (&cinfo, quality, TRUE); jpeg_start_compress (&cinfo, TRUE); uint8_t *vp, *up,*vpos, *upos; getYuvOffsets(width, height, yp, &up, &vp); vpos=vp; upos=up; uint32_t rgb = 0xFFFFFFFF; int z = 0; while (cinfo.next_scanline < cinfo.image_height) { unsigned char *ptr = line_buffer; for (int x = 0; x < width; x += 2) { rgb = YUVToRGB32WithEffect(*yp, *up, *vp, useEffect); *ptr++ = R32(rgb); *ptr++ = G32(rgb); *ptr++ = B32(rgb); // yp += mStrides[0]; rgb = YUVToRGB32WithEffect(*yp, *up, *vp, useEffect); *ptr++ = R32(rgb); *ptr++ = G32(rgb); *ptr++ = B32(rgb); // yp += mStrides[0]; up += mStrides[1]; vp += mStrides[2]; } if (mIs420) { if (z == 0) { vp = vpos; up = upos; z++; } else { vpos = vp; upos = up; z--; } } row_pointer[0] = line_buffer; jpeg_write_scanlines (&cinfo, row_pointer, 1); } jpeg_finish_compress (&cinfo); jpeg_destroy_compress (&cinfo); free (line_buffer); mJpegSize = bufferlen; LOGD("====== Jpeg size: %d ======", mJpegSize); return 0; }
void process_dvi_data(UINT8* dvi_data, int baseoffset, int regionsize) { DVI_Header DVI; UINT8* currptr = dvi_data + baseoffset; DVI.dv1 = R32(&currptr); DVI.dv2 = R16(&currptr); DVI.dv3 = R16(&currptr); DVI.dv4 = R32(&currptr); dviprintf("DVI Header\n"); dviprintf("Header ID %08x %c%c%c%c\n", DVI.dv1, (DVI.dv1>>24)&0xff, (DVI.dv1>>16)&0xff, (DVI.dv1>>8)&0xff, (DVI.dv1>>0)&0xff); dviprintf("Header Size (or 1) %04x\n", DVI.dv2); dviprintf("Header Version %04x\n", DVI.dv3); dviprintf("Annotation Offset %08x\n", DVI.dv4); if (DVI.dv1 != 0x56445649) { dviprintf("Header Error\n"); return; } dviprintf("\n"); AVSS_Header AVSS; AVSS.av1 = R32(&currptr); AVSS.av2 = R16(&currptr); AVSS.av3 = R16(&currptr); AVSS.av4 = R16(&currptr); AVSS.av5 = R16(&currptr); AVSS.av6 = R32(&currptr); AVSS.av7 = R16(&currptr); AVSS.av8 = R16(&currptr); AVSS.av9 = R16(&currptr); AVSS.av10 = R16(&currptr); AVSS.av11 = R32(&currptr); AVSS.av12 = R32(&currptr); AVSS.av13 = R32(&currptr); AVSS.av14 = R32(&currptr); AVSS.av15 = R16(&currptr); AVSS.av16 = R16(&currptr); AVSS.av17 = R32(&currptr); AVSS.av18 = R16(&currptr); AVSS.av19 = R16(&currptr); AVSS.av20 = R32(&currptr); AVSS.av21 = R32(&currptr); AVSS.av22 = R32(&currptr); AVSS.av23 = R32(&currptr); AVSS.av24 = R16(&currptr); AVSS.av25 = R16(&currptr); AVSS.av26 = R32(&currptr); AVSS.av27 = R16(&currptr); AVSS.av28 = R16(&currptr); AVSS.av29 = R32(&currptr); AVSS.av30 = R32(&currptr); for (int i=0;i<32;i++) { AVSS.av31[i] = R8(&currptr); } dviprintf(" AVSS Header\n"); dviprintf(" Header ID %08x %c%c%c%c\n", AVSS.av1, (AVSS.av1>>24)&0xff, (AVSS.av1>>16)&0xff, (AVSS.av1>>8)&0xff, (AVSS.av1>>0)&0xff); dviprintf(" Header Size %04x\n", AVSS.av2); dviprintf(" Header Version %04x\n", AVSS.av3); dviprintf(" Stream Group Count %04x\n", AVSS.av4); dviprintf(" Stream Group Size %04x\n", AVSS.av5); dviprintf(" Stream Group Offs %08x\n", AVSS.av6); dviprintf(" Stream Group Vers %04x\n", AVSS.av7); dviprintf(" Stream Size %04x\n", AVSS.av8); dviprintf(" Stream Version %04x\n", AVSS.av9); dviprintf(" Stream Count %04x\n", AVSS.av10); dviprintf(" Stream Offset %08x\n", AVSS.av11); dviprintf(" Header Pool Offset %08x\n", AVSS.av12); dviprintf(" Label Count %08x\n", AVSS.av13); dviprintf(" Label Offset %08x\n", AVSS.av14); dviprintf(" Label Size %04x\n", AVSS.av15); dviprintf(" Label Version %04x\n", AVSS.av16); dviprintf(" Vid Seq Hdr Offset %08x\n", AVSS.av17); dviprintf(" Vid Seq Hdr Size %04x\n", AVSS.av18); dviprintf(" Frame Version %04x\n", AVSS.av19); dviprintf(" Frame Count %08x\n", AVSS.av20); dviprintf(" Frame Size %08x\n", AVSS.av21); dviprintf(" First Frame Offset %08x\n", AVSS.av22); dviprintf(" EO Frame Offset %08x\n", AVSS.av23); dviprintf(" Frame Header Size %04x\n", AVSS.av24); dviprintf(" Frame Dir Size %04x\n", AVSS.av25); dviprintf(" Frame Dir Offset %08x\n", AVSS.av26); dviprintf(" Frame Dir Vers %04x\n", AVSS.av27); dviprintf(" Frame PerSec %04x\n", AVSS.av28); dviprintf(" UpdateFlag %08x\n", AVSS.av29); dviprintf(" FreeBlock %08x\n", AVSS.av30); dviprintf(" Patch "); for (int i=0;i<32;i++) { dviprintf("%02x", AVSS.av31[i]); }; dviprintf("\n"); dviprintf("\n"); for (int s=0;s<AVSS.av10;s++) { STRM_Header STRM; STRM.st1 = R32(&currptr); STRM.st2 = R16(&currptr); STRM.st3 = R16(&currptr); STRM.st4 = R16(&currptr); STRM.st5 = R16(&currptr); STRM.st6 = R16(&currptr); STRM.st7 = R16(&currptr); STRM.st8 = R16(&currptr); STRM.st9 = R16(&currptr); STRM.st10 = R32(&currptr); STRM.st11 = R32(&currptr); for (int i=0;i<16;i++) { STRM.st12[i] = R8(&currptr); } dviprintf(" STRM Header\n"); dviprintf(" Header ID %08x %c%c%c%c\n", STRM.st1, (STRM.st1>>24)&0xff, (STRM.st1>>16)&0xff, (STRM.st1>>8)&0xff, (STRM.st1>>0)&0xff); dviprintf(" Header Size %04x\n", STRM.st2); dviprintf(" Type %04x\n", STRM.st3); dviprintf(" SubType %04x\n", STRM.st4); dviprintf(" Header Count %04x\n", STRM.st5); dviprintf(" Next Stream Number %04x\n", STRM.st6); dviprintf(" Stream Group Numbr %04x\n", STRM.st7); dviprintf(" Padding %04x\n", STRM.st8); dviprintf(" Flag %04x\n", STRM.st9); dviprintf(" FrameSize %08x\n", STRM.st10); dviprintf(" FirstHeaderOffset %08x\n", STRM.st11); dviprintf(" Name "); for (int i=0;i<16;i++) { dviprintf("%02x", STRM.st12[i]); }; dviprintf("\n"); dviprintf("\n"); UINT8* subptr = dvi_data+STRM.st11+baseoffset; for (int h=0;h<STRM.st5;h++) { // I believe in these can be either CIMG or AUDI blocks, but we don't have any of the latter CIMG_Header CIMG; CIMG.ci1 = R32(&subptr); CIMG.ci2 = R16(&subptr); CIMG.ci3 = R16(&subptr); for (int i=0;i<80;i++) { CIMG.ci4[i] = R8(&subptr); } CIMG.ci5 = R32(&subptr); CIMG.ci6 = R16(&subptr); CIMG.ci7 = R16(&subptr); CIMG.ci8 = R32(&subptr); CIMG.ci9 = R32(&subptr); CIMG.ci10 = R16(&subptr); CIMG.ci11 = R16(&subptr); CIMG.ci12 = R16(&subptr); CIMG.ci13 = R16(&subptr); CIMG.ci14 = R16(&subptr); CIMG.ci15 = R16(&subptr); CIMG.ci16 = R16(&subptr); CIMG.ci17 = R16(&subptr); CIMG.ci18 = R32(&subptr); CIMG.ci19 = R16(&subptr); CIMG.ci20 = R16(&subptr); CIMG.ci21 = R16(&subptr); CIMG.ci22 = R16(&subptr); CIMG.ci23 = R32(&subptr); dviprintf(" CIMG Header\n"); dviprintf(" Header ID %08x %c%c%c%c\n", CIMG.ci1, (CIMG.ci1>>24)&0xff, (CIMG.ci1>>16)&0xff, (CIMG.ci1>>8)&0xff, (CIMG.ci1>>0)&0xff); dviprintf(" Header Size %04x\n", CIMG.ci2); dviprintf(" Version %04x\n", CIMG.ci3); dviprintf(" Original Name "); for (int i=0;i<80;i++) { dviprintf("%02x", CIMG.ci4[i]); }; dviprintf("\n"); dviprintf(" Original Frame %08x\n", CIMG.ci5); dviprintf(" Original Stream %04x\n", CIMG.ci6); dviprintf(" Padding %04x\n", CIMG.ci7); dviprintf(" Frame Count %08x\n", CIMG.ci8); dviprintf(" Next Header Offset %08x\n", CIMG.ci9); dviprintf(" X Position %04x\n", CIMG.ci10); dviprintf(" Y Position %04x\n", CIMG.ci11); dviprintf(" X Length %04x\n", CIMG.ci12); dviprintf(" Y Length %04x\n", CIMG.ci13); dviprintf(" X Crop %04x\n", CIMG.ci14); dviprintf(" Y Crop %04x\n", CIMG.ci15); dviprintf(" Drop Frame %04x\n", CIMG.ci16); dviprintf(" Drop Phrase %04x\n", CIMG.ci17); dviprintf(" Still Period %08x\n", CIMG.ci18); dviprintf(" Buffer Minimum %04x\n", CIMG.ci19); dviprintf(" Buffer Maximum %04x\n", CIMG.ci20); dviprintf(" Decode Algorithm %04x\n", CIMG.ci21); dviprintf(" Padding(2) %04x\n", CIMG.ci22); dviprintf(" DCFID %08x\n", CIMG.ci23); dviprintf("\n"); subptr = dvi_data+CIMG.ci9+baseoffset; } } /* Frame Dictionaries etc. */ /* is this just a seek table of sorts? the first doesn't have an entry (pointed to by First Frame Offset - AVSS.av22) the first two here are actually bad values, and the last one points to nothing */ /* some entries also seem to point to the wrong places?? I'm guessing this isn't used when playing back the data ... it seems like the upper and lower words are out of sync... */ dviprintf("Frame Dictionaries\n\n"); UINT8* frameptr = dvi_data + AVSS.av26 + 2 + baseoffset; // +2 ?? // UINT8* frameptr = dvi_data + AVSS.av26 + baseoffset; for (int f=0;f<AVSS.av20;f++) { FDICT_Header FDICT; FDICT.fd1 = R32(&frameptr); FDICT.fd1 = ((FDICT.fd1 & 0xffff0000)>>16) | ((FDICT.fd1 & 0x0000ffff)<<16); dviprintf(" %04d Frame Offset %08x\n", f, FDICT.fd1); UINT8* frameptr2 = dvi_data + ((FDICT.fd1 + baseoffset)&(regionsize-1)) ; FHEAD_Header FHEAD; FHEAD.fh1 = R32(&frameptr2); FHEAD.fh2 = R32(&frameptr2); FHEAD.fh3 = R32(&frameptr2); dviprintf(" Frame Num %08x\n", FHEAD.fh1); dviprintf(" Previous Offset %08x\n", FHEAD.fh2); dviprintf(" Frame Checksum %08x\n", FHEAD.fh3); } dviprintf("\n"); }