twain
DESCRIPTION
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 - PowerPoint PPT PresentationTRANSCRIPT
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
TWAIN ARCHITECTURE
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
RemoteSOURCE
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;}
TableITEM WAVE TYPE WAVE DEFINITION
1 Microsoft: unknown wave type WAVE_FORMAT_UNKNOWN
2 Microsoft ADPCM wave typ WAVE_FORMAT_ADPCM
3 Digispeech: CVSD wave type WAVE_FORMAT_IBM_CVSD
4 Microsoft, digispeech:CCITT std. WAVE_FORMAT_ALAW
5 Digispeech:OKI ADPCM wave type WAVE_FORMAT_OKI_ADPCM
6 Intel: ADPCM wave type DVI_ADPCM
7 digispeech wave type WAVE_FORMAT_DIGISTD
8 Yamaha ADPCM wave type WAVE_FORMAT_YAMAHA_ADPCM
9 Sound compreesion Sonarc type WAVE_FORMAT_SONARC
10 Creative labs ADPCM WAVE_FORMAT_CREATIVE_ADPCM
11 Dsp GROUP wave type WAVE_FORMAT_DSPGROUP
12 Echo Speech wave type WAVE_FORMAT_ECHOSCI
13 Audio File AF36 & AF10 WAVE_FORMAT_AUDIO_FILE_AF36
14 Audio Processing Tech. WAVE_FORMAT_APTX
15 Dolby Labs: Dolby-AC2 type WAVE_FORMAT_DOLBY_AC2
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 wFormatTagWAVE_FORMAT_ALAM (0X0006) USED IN U.SWAVE_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 01 82 163 32
THANK YOU