351 likes | 1.07k Views
TWAIN. Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to the needs of various applications. HOW THESE DEVICES ARE USED?. Applications were initially written for a single device
E N D
TWAIN • Open industry standard interface for the input devices to capture multimedia objects • More and more sophisticated devies are developed to cater to the needs of various applications
HOW THESE DEVICES ARE USED? • Applications were initially written for a single device • Eg. OCR reads a text and imports the file as ASCII file to the application. • Less flexible and so used different appl. Program for different devices. • Time consuming
Contd. • Later, device drivers were provided with all devices to provide an interface between program and the devices • Appl. program became more complex. • Complicated code for supporting multiple interfaces.
USAGE OF TWAIN • TWAIN working group created an open industry standard interface for input devices • Single TWAIN interface can be used to interface different devices.
BENEFITS OF TWAIN • Application developers can code a single TWAIN interface • Device manufacturers can write device drivers with TWAIN spec. • Multiple devices can be used in appl. Using “Acquire” & “Select Source”
OBJECTIVES • Supports multiple platform • Supports multiple devices • Widespread acceptance with std. interface • Extendibility & backward compatibility • Multidata format • Easy to use
APPLICATION LAYER • Sets up a logical connection with device • No rules on the design • User interface guideline to select sources • Select source helps to select multiple sources • Acquire helps to import data from the selected device.
PROTOCOL LAYER • Provides interface for appl. Layer • Comm. between appl. and acquisition layer • Specifies services provided by a source • Does not specify physical connection, control & devices info. • Source Manager – heart of protocol layer
SOURCE MANAGER • Provide std. API for all sources • Selection of sources • Establish logical sessions b/w appl. and sources. • Regulates traffic and validate transactions • Load or unload sources • Maintain default source • Keep track of sessions and session identities
ACQUISTION LAYER • Contains virtual device driver • Acts directly with device driver Local SOURCE Remote
Functions of source • Control of device • Acquisition of data from device • Transfer of data in agreed format • Control of devices by user DEVICE LAYER Receives the s/w commands and controls the device hardware accordingly
New WAVE RIFF file format • Two mandatory subchunks fmt data Four optional subchunks fact cue points playlist associated data list RIFF STRUCTURE RIFF( ‘WAVE’ <‘fmt’-ck> [<fact-ck>] [<cue-ck>] [<playlist-ck>] [<assoc-data-list>] <wave-data> )
FACT ,CUE POINT & Playlist • Fact chunk <fact-ck>->fact(<dwSampleLength:DWORD> ) Cue–point chunk struct { DWORD dwName; DWORD dwposition; FOURCC fccChunk; DWORD dwChunkStart; DWORD dwBlockStart; DWORD dwSampleOffset; Playlist chunk Struct { DWORD dwName; DWORD dwLength; DWORD dwLoops; }
Associated &Inst Chunk Associated data chunk: <assoc-data-list> ->LIST( ‘adtl’ <label-ck> <note-ck> <ltxt-ck> ) Inst chunk: <instrument-ck> -> inst( <bUnshiftedNote:BYTE> <chFineTune:CHAR> <chGain:CHAR> <bLowNote:BYTE> <bHighNote:BYTE> <bLowVelocity:BYTE> <bHighVelocity:BYTE> )
Setting up new WAVE types • Mandatory chunks fact fmt Extended waveform structure typedef struct waveformat_extended_tag { WORD wFormatTag; WORD wChannels; DWORD nSamplesPerSec; DWORD nAvgBytesPerSec; WORD nBlockAlign; WORD wBitsPerSample; WORD cbSize; }
Microsoft ADPCM WAVE file • Typedef struct adpcmoef_tag { int iCoef1; int iCoef2; } typedef struct adpcmwaveformat_tag { EXTWAVEFORMATEXT ewf; WORD nSamplesPerBlock; WORD nNumberCoef; ADPCMCOEFSET aCoeff[nNumCoef]; }ADPCMWAVEFORMAT;
WAVEFORMATEXT • wFormatTag WAVE_FORMAT_ADPCM • nChannels No. of channels in wave • nSamplesPerSec Frequency of the sample rate • nAvgBytesPerSec Avg. data rate • nBlockAlign block alignment of data in<data-ck> • wbitsPerSample No. of bits per sample of ADPCM • cbExtraSize size in bytes of WAVE format chunk • nSamplesPerBlock no. of samples per block • nNumCoef No. of coefficient sets in aCoef • aCoef coefficients used by wave
BLOCK • It has 3 parts Header, data & padding typedef struct adpcmblockheader_tag { BYTE bpredictor[nChannels]; Int iDelta[nChannels]; Int iSamp1[nChannels]; Int iSamp2[nChannels]; }ADPBLOKHEADER; CCITT Standard Companded WAVE types Stores file-dependent info about the contents of Wave data Two types OF wFormatTag WAVE_FORMAT_ALAM (0X0006) USED IN U.S WAVE_FORMAT_MULAW(OX0007) USED IN EUROPE Note: Rest as in previous slide
DVI ADPCM WAVE • DEFINED AS WAVE_FORMAT_DVI_ADPCM(OXOO11) • STRUCTURE typedef struct dvi_adpcmwaveformat_tag{ WAVEFORMATEXT ewf; WORD wSamplesPerBlock; }DVIADPCMWAVEFORMAT; • wFormatTag is WAVE_FORMAT_DVI_ADPCM.
BLOCK • Block has 2 parts • Header • Data Header Typedef struct dvi_adpcmblockheader_tag { Int iSamp0; BYTE bStepTableIndex; BYTE bReserved; }.DVI_ADPCMBLOCKHEADER;
Creative Labs ADPCM • Supports compression & decompression in real time • Fact Chunk : wFormatTag is WAVE_FORMAT_CREATIVE_ADPCM(0X0200) Typedef struct creative_adpcmwaveformat_tag { WAVEFORMATEXT ewf; WORD wRevision; }CREATIVEHEADPCMWAVEFORMAT; wRevision - Revision of the algorithm
Dolby Labs AC-2 Wave Type • Primarily used for music compression • The wFormatType of the fact chunk is WAVE_FORMAT_DOLBY_AC2(0X0030) WAVEFORMATEXT STRUCTURE: nAuxBitsCode – Auxillary bits code indicating no. of aux bits per block code no. of bits/block 0 0 1 8 2 16 3 32