main document ion
TRANSCRIPT
-
8/3/2019 Main Document Ion
1/100
A TOOL FOR USING MS ACCESS AS A MULTIMEDIA DATABASE
1.1EXISTING SYSTEM
The existing system of traditional image storageconsists of file organizations and manual search and
retrieval.
NECESSITY OF IMAGE COMPRESSION
The figures in table show how the qualitative transition
from simple text to full-motion video data and the disk space,
A Tool for Using MS Access as a Multimedia Database 1
Multime
dia data Size/Duration
Bits/pixels
Or
Bits/sample
Uncompres
sed
Size
(B for
bytes)
Transmissi
on
Bandwidth
( for bits)
Transmiss
ion
Time(usin
g a 28.8K
modem)A page
of text
11*8.5 Varying
resolution
4-8KB 32-64
Kb/page
1.1-2.2sec
Telephone
Quality
Speech
10sec 8bps 80KB 64kb/sec 22.2sec
Grayscal
e
Image
512*512 8bpp 262KB 2.1Mb/ima
ge
1min13se
c
Color
Image
512*512 24bpp 786KB 6.29Mb/im
age
3min39se
c
Medical
Image
2048*1680 12bpp 5.16MB 41.3Mb/im
age
23min54s
ec
SHD
Image
2048*2048 24bpp 12.58MB 100Mb/ima
ge
58min15s
ecFull-
motion
Video
640*480,1min
(30
frames/sec)
24bpp 1.66GB 221Mb/sec 5days8hrs
-
8/3/2019 Main Document Ion
2/100
transmission bandwidth, and transmission time needed to store
and transmit such uncompressed data.
Table Multimedia data types and uncompressed storage
space, transmission bandwidth, and transmission time required
.The prefix kilo-denotes a factor of 1000 rather than 1024.
The examples clearly illustrate the need for sufficient
storage space, large transmission bandwidth, and long
transmission time for image, audio, and video data. At the
present state of technology, the only solution is to compress
multimedia data before its storage and transmission, and
decompress it at the receiver for play back. For example, with a
compression ratio of 32:1, the space bandwidth, and transmission
time requirements can be reduced by a factor of 32, with
acceptable quality.
1.3 Proposed System
The proposed system is developed in such a way
that it integrates the features of DBMS and image compression.
The system can store and manage multimedia files over the
Microsoft database .it also has a compression utility for image
compression .the following are the advantage of the proposed
system. Effective compression of the images
Easy management of multimedia files
User friendly database interface
A Tool for Using MS Access as a Multimedia Database 2
-
8/3/2019 Main Document Ion
3/100
Multimedia file preview system which is helpful for easy
previewing
2. SYSTEM SPECIFICATION
2.1 HARDWARE SPECIFICATION:
Processor : PENTIUM IV
Speed : 2 GHz
RAM : 768 MB
Hard Disk Drive : 80 GB
CD Drive : 52 x MAX SAMSUNG
Monitor : 17color (SAMSUNG)
Mouse : LOGITEC Optical Mouse
Keyboard : MULTIMEDIA (127 Keys)
A Tool for Using MS Access as a Multimedia Database 3
-
8/3/2019 Main Document Ion
4/100
2.2 SOFTWARE SPECIFICATION:
FRONT END : Visual Basic .NET
BACK END : M.S.ACCESS
CODE BEHIND : TURBO C
Operating System : WINDOWS XP, OR ABOVE
2.3 FEATURES OF THE SOFTWARE USED
About Visual Basic .NET
Visual Basic .NET provides the easiest, most productive
language and tool for rapidly building Windows and Web
applications. Visual Basic .NET comes with enhanced visual
designers, increased application performance, and a powerful
integrated development environment (IDE). It also supports
creation of applications for wireless, Internet-enabled hand-held
devices. The following are the features of Visual Basic .NET
with .NET Framework 1.0 and Visual Basic .NET 2003 with .NET
A Tool for Using MS Access as a Multimedia Database 4
-
8/3/2019 Main Document Ion
5/100
Framework 1.1. This also answers why should I use Visual
Basic .NET, what can I do with it?
Powerful Windows-based Applications
Visual Basic .NET comes with features such as a powerful
new forms designer, an in-place menu editor, and automatic
control anchoring and docking. Visual Basic .NET delivers new
productivity features for building more robust applications easily
and quickly. With an improved integrated development
environment (IDE) and a significantly reduced startup time, Visual
Basic .NET offers fast, automatic formatting of code as you type,
improved IntelliSense, an enhanced object browser and XML
designer, and much more.
Building Web-based Applications
With Visual Basic .NET we can create Web applications
using the shared Web Forms Designer and the familiar "drag and
drop" feature. You can double-click and write code to respond to
events. Visual Basic .NET 2003 comes with an enhanced HTML
Editor for working with complex Web pages.
Simplified Deployment
With Visual Basic .NET we can build applications more
rapidly and deploy and maintain them with efficiency. Visual
Basic .NET 2003 and .NET Framework 1.1 makes "DLL Hell" a
thing of the past. Side-by-side versioning enables multiple
A Tool for Using MS Access as a Multimedia Database 5
-
8/3/2019 Main Document Ion
6/100
versions of the same component to live safely on the same
machine so that applications can use a specific version of a
component. XCOPY-deployment and Web auto-download of
Windows-based applications combine the simplicity of Web pagedeployment and maintenance with the power of rich, responsive
Windows-based applications.
Powerful, Flexible, Simplified Data Access
You can tackle any data access scenario easily with
ADO.NET and ADO data access. The flexibility of ADO.NET
enables data binding to any database, as well as classes,
collections, and arrays, and provides true XML representation of
data. Seamless access to ADO enables simple data access for
connected data binding scenarios. Using ADO.NET, Visual Basic
.NET can gain high-speed access to MS SQL Server, Oracle, DB2,
Microsoft Access, and more.
Improved Coding
You can code faster and more effectively. A multitude of
enhancements to the code editor, including enhanced
IntelliSense, smart listing of code for greater readability and a
background compiler for real-time notification of syntax errors
transforms into a rapid application development (RAD) coding
machine.
A Tool for Using MS Access as a Multimedia Database 6
-
8/3/2019 Main Document Ion
7/100
Direct Access to the Platform
Visual Basic developers can have full access to the
capabilities available in .NET Framework 1.1. Developers can
easily program system services including the event log,
performance counters and file system.
The new Windows Service project template enables to build
real Microsoft Windows NT Services. Programming against
Windows Services and creating new Windows Services is notavailable in Visual Basic .NET Standard, it requires Visual Studio
2003 Professional, or higher.
Full Object-Oriented Constructs
You can create reusable, enterprise-class code using full
object-oriented constructs. Language features include full
implementation inheritance, encapsulation, and polymorphism.
Structured exception handling provides a global error handler
and eliminates spaghetti code.
XML Web Services
XML Web services enable you to call components running
on any platform using open Internet protocols. Working with XML
Web services is easier where enhancements simplify the
discovery and consumption of XML Web services that are located
within any firewall. XML Web services can be built as easily as
you would build any class in Visual Basic 6.0. The XML Web
A Tool for Using MS Access as a Multimedia Database 7
-
8/3/2019 Main Document Ion
8/100
service project template builds all underlying Web service
infrastructure.
Mobile Applications
Visual Basic .NET 2003 and the .NET Framework 1.1 offer
integrated support for developing mobile Web applications formore than 200 Internet-enabled mobile devices. These new
features give developers a single, mobile Web interface and
programming model to support a broad range of Web devices,
including WML 1.1 for WAPenabled cellular phones, compact
HTML (cHTML) for i-Mode phones, and HTML for Pocket PC,
handheld devices, and pagers. Please note, Pocket PC
programming is not available in Visual Basic .NET Standard, it
requires Visual Studio 2003 Professional, or higher.
COM Interoperability
You can maintain your existing code without the need to
recode. COM interoperability enables you to leverage your
existing code assets and offers seamless bi-directionalcommunication between Visual Basic 6.0 and Visual Basic .NET
applications.
Reuse Existing Investments
A Tool for Using MS Access as a Multimedia Database 8
-
8/3/2019 Main Document Ion
9/100
You can reuse all your existing ActiveX Controls. Windows
Forms in Visual Basic .NET 2003 provide a robust container for
existing ActiveX controls. In addition, full support for existing ADO
code and data binding enable a smooth transition to VisualBasic .NET 2003.
Upgrade Wizard
You upgrade your code to receive all of the benefits of
Visual Basic .NET 2003. The Visual Basic .NET Upgrade Wizard,
available in Visual Basic .NET 2003 Standard Edition, and higher,
upgrades up to 95 percent of existing Visual Basic code and
forms to VB .NET with new support for Web classes and User
Controls.
The language of C
C has now become a widely used professional language for
various reasons
It has high-level constructs
It can handle low-level activities
It produces efficient programs.
It can be compiled on a variety of computers.
The various characteristic of C are
Small size
Extensive use of function callsA Tool for Using MS Access as a Multimedia Database 9
-
8/3/2019 Main Document Ion
10/100
Loose typing unlike PASCAL
Structured language
Low level (Bitwise) programming readily available
Pointer implementation-extensive use of pointers for
memory, array, structures and functions.
Complier-based
In the first place, it is a complier based language. This on
one hand means that all grammatical errors must be out of the
program before it will do anything .it also means that it does
exactly the same outside the developing environment as it does
inside once you have got it running.
Easy use of C code with code of other languages
In C it is very easy to combine C code with that from other
languages, especially from Pascal or Assembler .In some
advanced versions of C it is even allowed to write Assembler code
right in the middle of your C program!.
The Advantages of C
The good news about C is that we can write code which
runs quickly, and our program is very close to the hardware .It
means that we can access low level facilities in our computer
A Tool for Using MS Access as a Multimedia Database 10
-
8/3/2019 Main Document Ion
11/100
quite easily ,without the complier or run time system stopping
you from doing something potentially dangerous .
The use of complier directives to the pre-processor makes itpossible to produce a single version of a program which can be
complied on several different types of computer. In this sense C
is said to be very portable. The function libraries are standard for
all versions of C so they can be used on all systems.
Programming in C or Assembler
C is a high-level language which is complied rather than
assembled .The processor of compilation is very complex, but the
basic operation resembles that of assembly, with one exception-
each line of the program can produce one or more machine code
instructions (compared to the usual one-to-one correspondence
between assembler and machine code).
Most programs are written in a high level
language such as C, rather than assembler .However, for some
specific tasks, assembler me be a more appropriate language.
Programs can be clearer, better structured.
It is easy to use pre-written functions, which may be quite
complicated. The C complier, if written carefully, can automatically take
care of some problems, such as allocation of memory
addresses.
A Tool for Using MS Access as a Multimedia Database 11
-
8/3/2019 Main Document Ion
12/100
Programming in C is a tremendous asset in those
areas where we may want to use Assembly language but would
rather keep it a simple to write and easy to maintain
program. It has been said that a program written in C will pay apremium of a 20 to 50% increase in runtime because no high
level language is as compact or as fast as Assembly Language.
However, the time saved in coding can be tremendous, making it
the most desirable language for many programming chores. In
addition ,since most programs spend 90 percent of their
operating time in only 10 percent or less of the code, it is possible
to write a program in C , then rewrite a small portion of the code
in Assembly language and approach the execution speed of the
same program if it were written entirely in Assembly Language.
C is standardized.
C is ubiquitous.
C is a low-level language.
C is a small language.
C is a permissive language
Strengths of C
Efficiency
Portability
Power
Flexibility
Standard library
Integration with UNIX
3. ABOUT THE PROJECT
A Tool for Using MS Access as a Multimedia Database 12
-
8/3/2019 Main Document Ion
13/100
There are many multimedia files such as audios and videos
we use in our day-to-day life .some of these are music files,
personal videos and family photographs. It is very painful tomaintain and manage huge collections of these multimedia files
since there are not ordered. When we want a multimedia we
usually search the particular file in a collection of files which are
not integrated.
To solve this problem we should employee a database to
store, manage and retrieve these multimedia files. This will help
us to manage the multimedia files easily and all the files will be
integrated single Microsoft database files. I have implemented
this software for audio, video and image files. And I have
implemented DCT algorithm for image compression.
Digital Image compression is one of the major areas of
research in image processing. Digital compression is vital for
several reasons. It provides the quality and reliability of digital
technology, it packs more information into less transmission
space, and it reduces the storage needed on disc or tape.
For instance, to represent one frame of a video in the 0s
and 1s of computer language, it takes over a megabyte of
memory. Since there are 30 frames in the standard second of
video, you would need 33MB of memory transfer or storage for
one second of video. Compression methods can reduce this data
A Tool for Using MS Access as a Multimedia Database 13
-
8/3/2019 Main Document Ion
14/100
at nearly a 200:1 ratio-creating a much more manageable and
cost-effective data stream.
All digital images are collections of binary data (bits) thatare organized into pixels .All digital images should be regarded as
groups of pixels .pixels are the standard unit of measure that
dictates the images size; not only the actual size that the image
can be optimally reproduced (i.e. 4*6 inches), but also the size
that thedigital file will be (I.e.6 megabytes). The number of pixels
per inch (PPT) is the resolution of the image file. Note that pixels
per inch are not to be confused with dots per inch (DPI). DPI is a
term that refers to printing and the amount of ink that actually is
placed upon the print medium. DPI and PPI are completely
unrelated to each other. However, as it has become common
practice for scanner manufacturers and other so-called
authorities to use DPI as a measure of resolution, either term is
generally acceptable.
The above review of image file basics refers to raw or
uncompressed image files. Obviously, image files tend to be quite
large in terms of the amount of disk space required to store
them. A standard floppy disk has a capacity of about
1,400,000bytes (1.4MB), so even a single 4*6 image scanned at
300 ppi would requires 5 floppies to store it. With the advent of
larger removable media such as zip disks and other similar
storage options, this situation is becoming less a concern, but the
sheer size of digital image files still demands a more efficient
method of storage. File compression is quickly becoming standard
A Tool for Using MS Access as a Multimedia Database 14
-
8/3/2019 Main Document Ion
15/100
procedure to facilitate not only compact storage but the
movement of image files. Moving files is commonly done either
by placing the file on a removable disk (floppy, ZIP disk, CD, etc)
and physically transporting it, or by using what has become aglobally used tool: Electronic Transfers.
The basic idea of image compression techniques is to use
an inevitable linear transformation to transform the given
correlated image array to an array of uncorrelated variables that
can be represented by much fewer number of bits compared to
the original image array.
AN INTRODUCTION TO JPEG
JPEG (Pronounced jay-peg) is a standardized imagecompression mechanism .JPEG stands for Joint Photographic
Experts Group, the original name of the committee that wrote the
standard.
JPEG is designed for compressing full-color or gray-
scale images of natural, real-world scenes. It works well on
photographs, naturalistic artwork, and similar material; not so
well on lettering, simple cartoons, or line drawings. JPEG handles
only still images, but there is a related standard called MPEG for
motion pictures.
JPEG is lossy meaning that the decompressed image
isnt quite the same as the one you started with. (There areA Tool for Using MS Access as a Multimedia Database 15
-
8/3/2019 Main Document Ion
16/100
lossless image compression algorithms, but JPEG achieves much
greater compression than is possible with loss loss methods.)JPEG
is designed to exploit known limitations of human eye, notably
the fact that smaller color changes are perceived less accuratelythan small changes in brightness. Thus, JPEG is intended for
compressing images that will be looked at by humans. If you plan
to machine-analyze your images; the small errors introduced by
JPEG may be a problem for you, even if they are invisible to the
eye.
A useful property of JPEG is that the degree of
lossiness can be varied by adjusting compression parameters
.This means that the image makers can tradeoff file size against
output image quality. You can make extremely small files if you
dont mind poor quality; this is useful for applications such as
indexing image archives. Conversely, if you arent happy with the
output quality at the default compression setting, you can jack up
the quality until you are satisfied, and accept lesser compression.
Another important aspect of JPEG is that decoders can
trade off decoding speed against image quality, by using fast but
inaccurate approximations to the required calculations. Some
viewers obtain remarkable speedups in this way.(Encoders can
also trade accuracy for speed ,but theres usually less reason to
make such a sacrifice when writing a file)
An Overview of JPEG
A Tool for Using MS Access as a Multimedia Database 16
Fq(u, v)F(u,v)f(i , j)
Zigzag
DCT Quantization
Coding Tables
DPCM
RLC
EntropyCoding
Data
Tables
Header DC
AC
QuantizTables
-
8/3/2019 Main Document Ion
17/100
The image is divided into 8*8 blocks .After this all
operations are performed block wise.
Each block is the input to the FDCT block.
The 64 DCT coefficients are then uniformly quantized in
conjunction with a 64-element quantization table (lossy
encoding).
All the quantized coefficients are ordered into a zigzag
sequence.
Finally Entropy coding is carried out.
MAJOR STEPS
The major steps involved in the image compression are
A Tool for Using MS Access as a Multimedia Database 17
-
8/3/2019 Main Document Ion
18/100
o DCT (Discrete cosine transform)
o Quantization
o Zigzag Scan
o DPCM on DC component
o RLE on AC components
o Entropy Coding
The Discrete Cosine Transform
The major part of the compression process is a
mathematical transform known as the discrete cosine
Transform (DCT) .The DCT is in a class of mathematical
operations that include the well known Fast Fourier Transform
(FFT), as well as many others. The basic operation performed
by these transforms is to take a signal and transform it from
one type of representation to another.
This transformations is done frequently whenanalyzing audio sample using the FFT.when we collect a set of
sample points from an incoming audio signal, we end up with
the representation of a signal in the time domain. That is, we
have a collection of points that show what the voltage was for
A Tool for Using MS Access as a Multimedia Database 18
-
8/3/2019 Main Document Ion
19/100
the input signal at each point in time. The FFT transforms the
set of sample points into a set of frequency values that
describes exactly the same signal.
Each of the sample points represents the relativevoltage or amplitude of the signal at the specific point in time.
In the time domain representation of the signal, each of the
points on the X-axis represents a different point in time, and
each of the points on the Y-axis represents a specific
magnitude of the signal. After processing the data points with
an FFT, the X-axis no longer has the same meaning. Now, each
point on the X-axis represents a specific frequency, and the Y-
axis represents the magnitude of that frequency.
From Spatial Domain to Frequency Domain:
F(u,v)
f(i ,j)
DCT
Another important point to make this type of
implementation function is that the function is reversible. In
principle, the same set of points can be processed through an
A Tool for Using MS Access as a Multimedia Database 19
-
8/3/2019 Main Document Ion
20/100
inverse FFT function. The two transformation cycles are
essentially loss less, Except for loss of precision resulting from
rounding and truncation errors.
The DCT is closely related to the Fourier transform,and produces a similar result. it takes a set of points from the
spatial domain and transforms them into an identical
representation in the frequency domain; however, we are
going to introduce an additional complication in this particular
instance .Instead of a two-dimensional signal plotted on a x
and y-axis, the DCT will operate on a three dimensional signal
plotted on an X, Y and Z-axis.
If the signal is a graphical image, the X and Y-axes
are the two dimensions of the screen .The amplitude of the
signal in this case is simply the value of a pixel at a
particular point on the screen .For example, an eight-bit value
used to a represent a grey-scale value. So a graphical image
displayed on the screen can be thought of as a complex three-
dimensional signal, with the value on the z-axis denoted by the
color on the screen at a given point .this is the spatial
representation of the signal.
The DCT can be used to convert spatial information
into frequency or Spectral information, with the X and Y-
axes representing frequencies of the signal in two different
dimensions .And like the FFT, there is an Inverse DCT (IDCT)
function that can convert the spectral representation of the
signal back to a spatial one.
Definitions for DCT
A Tool for Using MS Access as a Multimedia Database 20
-
8/3/2019 Main Document Ion
21/100
The actual formula for the two-dimensional DCT is
shown with its partner ,the IDCT .the DCT is performed on an
N*N square matrix of pixels values, and it yields an N*N square
matrix of frequency coefficients .The formula looks somewhat
intimidating at first glance ,but it can be done with a relatively
straightforward piece of code
DEFINITIONS
Discrete Cosine Transform (DCT):
7
F (u, v) = (u) (v) cos (2i+1).u.Cos (2j+1).v .f (i, j)
4 i=0 j=0 16 16
() = {1/2 for =0
1 otherwiseInverse Discrete Cosine Transform (IDCT):
7 7
F( i ,j) = 1 (u) (v) cos (2i+1).u .cos (2j+1).v.
F(u,v)
4 u=0 v=0
16 16
() ={ for =0
1 otherwise
DCT implementationA Tool for Using MS Access as a Multimedia Database 21
-
8/3/2019 Main Document Ion
22/100
DCT implementations typically break the image down
into smaller, more manageable blocks. The JPEG group selected
an 8*8 block for the size of their DCT calculation .while increasingthe size of DCT block would probably give better compression,
doesnt take long to reach the point of diminishing returns.
Research shows that the connections between the pixels tent to
diminish quickly such that the pixels even 15 or 20 positions
away are of very little use as predictors. The computation time
would be longer, if we select big size of blocks .the JPEG
committee elected to stick with 8*8.This type of compression is
referred to as block coding.
The 8* 8 block is represented as
140 144 147 114 140 155 179 175
144 152 140 147 140 148 167 179
152 155 136 167 163 162 152 172
168 145 156 160 152 155 136 160
162 148 156 146 140 136 147 162
147 167 140 155 155 140 136 162
136 156 123 167 162 144 140 147
148 155 136 155 152 147 147 148
A Tool for Using MS Access as a Multimedia Database 22
-
8/3/2019 Main Document Ion
23/100
The coefficient form of the DCT can be calculated using
matrix operations. We first create an N*N matrix known as cosine
transforms C.
Once the cosine transform matrix has been built, wetranspose it by rotating it around the main diagonal.
The matrix is referred to in code as Ct, the transposed
cosine transform matrix. Building this matrix is done only once
during program initialization .both matrices can be built at the
same time with a relatively short loop
Once these two matrices have been built, we take
advantage of the alternative definition of the DCT function.
When multiplying two square matrices together, the
arithmetic cost of each element of the output matrix will be N
multiplication operations and N addition operations .Since we
perform two matrix multiplications to create the DCT matrix each
element in the transformed DCT matrix was created at the cost if
2N multiplications and additions, a considerable improvement
over the nested loop definition of the DCT.
OUPUT FOR DCT:
A Tool for Using MS Access as a Multimedia Database 23
-
8/3/2019 Main Document Ion
24/100
Quantization
The JPEG compression process is six step procedures,
the first step being a DCT transformation.DCT is lossless
transformation that prepares for the lossy or quantization,
stage of the process.
The DCT output matrix takes more space to store than
the original matrix of pixels .The input to DCT function consists of
8 bit pixel values that come out can range from a low of-1024 to
a high of +1023 occupying 11 bits.
The drastic action used to reduce the number of bits
required for storage of the DCT matrix is referred to as
quantization. This is simply the process of reducing the number
of bits needed to store an integer value by reducing the precision
of the integer. Once a DCT image has been compressed, we can
reduce the precision of the co-efficient more and more as we
move away from the DC coefficient at the origin. The farther
A Tool for Using MS Access as a Multimedia Database 24
185 -17 14 -8 23 -9 -13 -18
20 -34 26 -9 -10 10 13 6
-10 -23 -1 6 -18 3 -20 0
-8 -5 14 -14 -8 -2 -3 8
-3 9 7 1 -11 17 18 15
3 -2 -18 8 8 -5 0 -6
8 0 -2 3 -1 -7 -1 -1
0 -7 -2 1 1 4 -6 0
-
8/3/2019 Main Document Ion
25/100
away from (0,0) the less the element contributes to the graphical
image, so the less we care about maintaining rigorous precision
in its value.
The JPEG algorithm implements quantization using aquantization matrix. For every element position in the DCT
matrix, a corresponding value in the quantization matrix gives a
quantum value. The quantum value indicates what the step size
is going to be for that element in that element in the compressed
rendition of the picture, with values from 1 to 255.
The elements that matter most to the picture will be
encoded with a small step size, 1 offering the most precision.
Values can become higher as we move away from the origin. The
actual formula for quantization is quite simple.
Quantized value (i, j) = DCT (i, j)/quantum (i, j) rounded to the
nearest integer.
It becomes clear that quantization values above 25 or
perhaps 50 assure that virtually all higher. Frequency component
will be rounded down to 0 only if the high frequency coefficients
get up to unusually large values will they be encode as non-zero
values.
During decoding, the dequantization formula operates in reverse.
DCT (i, j) = quantized value (i, j) * quantum (i, j)
A Tool for Using MS Access as a Multimedia Database 25
-
8/3/2019 Main Document Ion
26/100
Once again, from this we can see that when you
use large quantum values, you run the risk of generating large
errors in the DCT output during dequantization. Fortunately,
errors generated in the high frequency component duringdequantization normally dont have a serious effect on the
picture quality.
Quantization matrix
Clearly an enormous number of schemes could be used to
define values in the quantization matrix .At least two
experimental approaches can test different values.
One measures the mathematical error found between an
input and output image after it has been decompressed, trying to
determine an acceptable level of error. A second approach tries
to judge the effect of decompression on the human eye, which
may not always correspond exactly with mathematically
differences in the error levels. Since the quantization matrix can
obviously be defined a run time when compression takes place,
JPEG allows the use of any quantization matrix.
The quantization tables used in the test code supplied with
this program are created using a very simple algorithm. To
determine the value of the quantum step size, the user inputs a
single quality factor which should range from 1 to 25. Value
larger than 25 would work, but the picture quality has degraded.
A Tool for Using MS Access as a Multimedia Database 26
-
8/3/2019 Main Document Ion
27/100
For enough at quality level 25 to make going any further an
exercise futility.
The quantumlevel sets the
difference
between adjoining
bands of the same
quantization level.
These bands are oriented on diagonal lines across the matrix, so
quantization levels of the same values are all roughly the same
distance from the origin. An example of what the quantization
matrix looks like with a quality factor of two as shown in figure.
A Tool for Using MS Access as a Multimedia Database 27
3 5 7 9 11 13 15 17
5 7 9 11 13 15 17 19
7 9 11 13 15 17 19 21
9 11 13 15 17 19 21 23
11 13 15 17 19 21 23 25
13 15 17 19 21 23 25 27
15 17 19 21 23 25 27 29
17 19 21 23 25 27 29 31
-
8/3/2019 Main Document Ion
28/100
-
8/3/2019 Main Document Ion
29/100
elected to handle zero values differently from other coefficient
values.
Instead of replying on Huffman or arithmetic coding tocompress the zero values, they are coded using a run length-
encoding (RLE) algorithm. A simple code is developed that gives
a count of consecutive zero values in the image. Since over half
of the coefficients are quantized to zero in many images, this
gives an opportunity for outstanding compression.
One way to increase the length or runs is to reorder the
coefficients in the zigzag sequence. Instead of compressing in
row major order, as a programmer would probably do, the JPEG
algorithm moves through the block along diagonal paths,
selecting what should be highest value elements first and
working its way toward the values likely to be lowest.
The actual path of zigzag sequence is shown in the figure.
In the code used in this chapter, the diagonal sequences of
quantization steps follow exactly the same lines, so the zigzag
sequence should be optimal for our purposes.
A Tool for Using MS Access as a Multimedia Database 29
-
8/3/2019 Main Document Ion
30/100
Maps 8 * 8 to a 1 * 64 vector.
DPCM on DC Components
The Steps involved in this process are
The DC component value in each 8*8 block is large and
varies across blocks but is often close to that in the previous
block.
Differential Pulse Code Modulation (DPCM): Encode the
difference between the current and previous 8 * 8 blockRemember ,smaller number -> fewer bits
A Tool for Using MS Access as a Multimedia Database 30
-
8/3/2019 Main Document Ion
31/100
RLE on AC Components
The steps involved in this process
The 1*64 vectors have a lot of zeros in them, more so
towards the end of the vector.
Higher up entries in the vector capture higher frequency
(DCT) components which tend to be capturing less of the
content.
Could have been as a result of using a quantization table.
Encode a series of 0s as a (skip, value) pair, where skip is
the number of zeros and value is the next non-zero
component.
Send (0, 0) as end-of-block sentinel value.
A Tool for Using MS Access as a Multimedia Database 31
0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 2
-
8/3/2019 Main Document Ion
32/100
F (0, 0) is called the DC component and the rest of F ( i , j ) are
called AC components.
Entropy coding
A run is defined as a sequence of identical
characters .the run-length encoding technique takes advantage
of the presence of runs and represents then in an abbreviated,
compressed form. This technique is only efficient when at least
two-character runs are transmitted, because for one-character
runs, the code is twice as long as the character. This requires
using a marker indicating that what is being transmitted is either
run in an abbreviated form or a literal character. Three characters
are needed to represent a run a compression marker, a literal
marker and a counter. The problem of choosing the compression
marker is especially delicate, since it should not be confused with
a literal character being transmitted.
Since compressing runs results in a sequence of three
characters, this technique should be applied to runs of at least
four characters. The maximum length of a run that can be
represented by the triple is 255 for 8-bit ASCII.
The run length coding is only modestly efficient text file in
which only the blank character has a tendency to be repeated. In
this case, a predecessor of this technique can be applied, null
A Tool for Using MS Access as a Multimedia Database 32
-
8/3/2019 Main Document Ion
33/100
suppression, which compress only runs of blanks, which
eliminates the need to identify the character being compressed.
Run-length encoding is very useful when applied to files,which are almost, guaranteed to have many runs of at least four
characters. One example is relational databases. Run-length
encoding is used in the compression of facsimile images, which
are composed of combinations of black and white pixels.
A serious drawback of run-length encoding is that it relies
entirely on the occurrences of runs. In particular, this method
taken by it is unable to recognize the high frequency of the
occurrence of certain symbols, which call for short codes.
4. ALGORITHM
Here the standard JPEG image compression algorithm was
implemented. This was done using the following.
The image is divided into 8*8 blocks. After this all
operations are performed block wise.
Each block is the input to the FDCT block.
The 64 DCT coefficients are then uniformly quantized in
conjunction with a 64-element quantization table (lossy
encoding)
A Tool for Using MS Access as a Multimedia Database 33
-
8/3/2019 Main Document Ion
34/100
All the quantized coefficients are ordered into a zigzag
sequence.
Finally Entropy coding is carried out.
5. SYSTEM DESIGN
5.1 FLOW CHART
A Tool for Using MS Access as a Multimedia Database 34
START
INITILIZATION
READ PIXEL STRIP
FORWARD DCT
WRITE DCT DATA
OUTPUT CODE
COMPRESSED
IMMAGE
READ DCT DATA
INVERSE DCT
WRITE PIXEL STRIP
DECOMPRESSEDGE
STOP
-
8/3/2019 Main Document Ion
35/100
5.2. DATA FLOW DIAGRAM
COMPRESSION IMAGES
A Tool for Using MS Access as a Multimedia Database 35
Compression
Bitmap
images JPEG
-
8/3/2019 Main Document Ion
36/100
DECOMPRESSION IMAGES
INSERTIMAGES
EXTRACT IMAGESA Tool for Using MS Access as a Multimedia Database 36
Decompression
Bitmap
imagesJPEG
Byte
Array
Image Name
DatabaseUser
ByteArray
Converter
Compressio
n
Bitmap
ImagesJPEGImages
-
8/3/2019 Main Document Ion
37/100
Insert Audio
Extract Audio
A Tool for Using MS Access as a Multimedia Database 37
User
Byte Array
ConverterAudio
Database
Byte Array
ConverterSearch by
name
Decompression
Database
Byte Array
User
Bitmap images
Search byName
Byte Array
Converter
Database
Audio
User
Audio
Audio
-
8/3/2019 Main Document Ion
38/100
Insert Video
A Tool for Using MS Access as a Multimedia Database 38
Byte Array
Converter
Video
Database
User
-
8/3/2019 Main Document Ion
39/100
Extract Video
5.3 Input Design
Input design is a gateway between users and the database.
They use these input screens is to perform operations and view
their results. The designs of input focusing on controlling the
amount of input required controlling the errors, avoid delay extra
steps, and keeping the process simple. This system is designed in
such a way that it is most user-friendly to all range of its users.
Output screens play and important role in representing data
and multimedia files back to the users of the system. At most
care is taken to make it simple and easily understandable by the
A Tool for Using MS Access as a Multimedia Database 39
Video
Search byName Byte Array
Converter
Database
VideoUser
Video
-
8/3/2019 Main Document Ion
40/100
-
8/3/2019 Main Document Ion
41/100
Although each test has a different purpose, all of them work
to verify that all system elements have been properly integrated
and perform allocated functions.
If testing is conducted successfully, it will uncover errors in
the software. As a secondary benefit, testing demonstrates that
the software appears to be working according to the specification
and that the performance requirements appear to have been
met.
In addition, data collected as testing is conducted, provides
a good indication of software reliability and some indication of
the software quality as a whole. However, testing cannot show
the absence of defects, it can only show that software errors are
present.
All the tests should be traceable to customer
requirements .A good test has high probability of finding an error.
To achieve this goal, the tester must understand the software
and attempt to develop a mental picture of how the software
might fail.
TESTING OBJECTIVES
A Tool for Using MS Access as a Multimedia Database 41
-
8/3/2019 Main Document Ion
42/100
Testing is the process of executing a program with the
intention of finding an error. A good test case is the one that has
a high probability of finding an as-yet undiscovered error
successful test is that which uncovers an as-yet undiscoverederrors
A successful test is that in which no errors are fond. The
objective is to design tests that systematically uncover different
classes of errors and do so with a minimum amount of time and
effort.
SYSTEM TESTING
For every software project, there is an inherent conflict of
interest that occurs as testing begins. The people who have build
the software, are now asked to test the software. This seems
harmless in itself, after all, who knows the program better than
its developers?
Unfortunately, these same developers have a vested
interest in demonstrating that the program is error free, that it
will be completed on schedule and within budget. From
psychological point of view, software analysis and testing (along
with coding) is constructive works. The software engineer creates
a computer program, its documentation and data structures.
When testing commences, there is subtle, yet definite
attempt, to break the thing that the software engineer built. From
A Tool for Using MS Access as a Multimedia Database 42
-
8/3/2019 Main Document Ion
43/100
the point of view of the builder, testing can be destructive. The
primary objective of the test design is to derive a set of tests that
has the highest likelihood for uncovering defects in the software.
To accomplish this objective, two categories of test casedesigning techniques were used White Box Testing and
Black box Testing.
White Box Testing focuses on the program control
structure. Test cases are derived to ensure that all statements in
the program have executed at least once during testing and that
all logical conditions have been exercised. White box testing is
testing in the small implying that this test typically applied to
small program components.
Black Box Testing on the other hand broadens our focus
and might be called testing in the large. Black box tests are
designed to validate functional requirements without regard to
the internal working of a program. Black Box testing focuses on
the information domain of the software, deriving test coverage.
The requirement for high quality software demands more
systematic approach to testing.
The specification states what the program should do and
how it should perform under various conditions are tested. The
test cases are developed for each condition or combination of
conditions and submitted for processing.
A Tool for Using MS Access as a Multimedia Database 43
-
8/3/2019 Main Document Ion
44/100
-
8/3/2019 Main Document Ion
45/100
The various unit-tested modules were integrated. Rigorous
integration testing is conducted to make the application free of
any interface errors that may occur during transactions.
ALPHA TESTING
The developer in collaboration does alpha testing with the
end user. The developer guides the end user all the way while
observing reactions and feedback Beta testing, on the other
hand, releases the product to the end user.
He is at liberty to produce as the requirements dictate. The
user records all the problems (real and imaginary) that are
encountered during beta testing and reports these to the
developer at regular intervals. As a result of this the software
developer makes modifications and then prepares for release of
the software product to entire customer base.
IMPLEMENTATION
Implementation is the process of having the systems
personal check out and put new equipment into use, training the
users to install and try the new system and construct any file that
are needed to use it. It is the final and important phase in the
system life cycle.
Depending on the size of the organization that is involved in
using the application and the risk associated with its use, system
A Tool for Using MS Access as a Multimedia Database 45
-
8/3/2019 Main Document Ion
46/100
developers may choose to carry out the operation in only one
area of the firm, say, in one department or with only one or two
persons. The term implementation has different meanings,
ranging from the conversion of a basic application to completereplacement of computer system. The procedure is however,
virtually the same. Implementation includes all the activities that
take place to convert from old system to new.
The new system may be totally new replacing an existing
manual or automated system or it may be major modification to
an existing system.
The method of implementation and time scale to be
adopted is found out initially. The system is tested properly and
at the same time the users are trained in the new procedure.
Proper implementation is essential to provide a reliable system to
meet organization requirements. Successful implementation may
not guarantee improvement in the organization using new
system, but it will prevent improper installation. The
implementation involves the following things.
Proper planning
Investigation of the system and constraints.
Design the methods to achieve the change over. Training the staff in the changed phase.
Evaluation of the change over method.
MAINTENANCE
A Tool for Using MS Access as a Multimedia Database 46
-
8/3/2019 Main Document Ion
47/100
The maintenance phase focuses on change that is
associated with error correction, adaptations required as the
software environment evolves and changes due to enhancements
brought about by changing customer requirements themaintenance phase reapplies the steps of the definition and
development phase, but does so I the context of existing
software. Four types of changes are encountered during the
maintenance phase.
Correction: Even with the best quality assurance activities, it is
likely that the customer will uncover defects in the software.
Correct maintenance changes the software to correct defects.
Adaptation: Over time, the original environment for which the
software was developed is likely to change. Adaptive
maintenance results in modification to the software to
accommodate to its external environment.
Enhancement: As software is used, the customer/user will
recognize additional functions that will provide benefits. Perfect
maintenance extends the software beyond the original functional
requirements.
Prevention: Computer software deteriorates due to change and
because of this, preventive maintenance, often called software
engineering must be conducted to enable the software to serve
the needs of its end users. In essence, the preventive
A Tool for Using MS Access as a Multimedia Database 47
-
8/3/2019 Main Document Ion
48/100
-
8/3/2019 Main Document Ion
49/100
-
8/3/2019 Main Document Ion
50/100
INSERT IMAGE
A Tool for Using MS Access as a Multimedia Database 50
-
8/3/2019 Main Document Ion
51/100
COMPRESSING IMAGE
A Tool for Using MS Access as a Multimedia Database 51
-
8/3/2019 Main Document Ion
52/100
DECOMPRESSING IMAGE
A Tool for Using MS Access as a Multimedia Database 52
-
8/3/2019 Main Document Ion
53/100
INSERT AUDIO
A Tool for Using MS Access as a Multimedia Database 53
-
8/3/2019 Main Document Ion
54/100
INSERT VIDEO
A Tool for Using MS Access as a Multimedia Database 54
-
8/3/2019 Main Document Ion
55/100
8. CONCLUSION AND FUTURE ENHANCEMENT
In my project I have implemented the coding to store
retrieve and image multimedia in M.S.Access. In my project
we have used DCT for image compression using C language. In
DCT compression we have used discrete cosine transform for
A Tool for Using MS Access as a Multimedia Database 55
-
8/3/2019 Main Document Ion
56/100
compression. We varied the threshold value in order to vary the
compression ratios.
The audio compression algorithm mpeg layer 3(mp3) can
implemented along with this to compress the audio files before
storing it in the database and decompressing it when we retrieve
it.
9. BIBLOGRAPHY AND REFERENCE
[1] DIGITAL IMAGE PROCESSING
A Tool for Using MS Access as a Multimedia Database 56
-
8/3/2019 Main Document Ion
57/100
Rafel .C.Gonzalez & Richard .E.Woods (Addition Wesley Publishing company , 1993)
[2] IMAGE PROCESSING IN C
Dwayne Phillips (BPB Publications, 1995)
[3] Let us C
Yashavant Kanetkar
[4] VISUAL BASIC DOT NETShirish Chavan
[5] WEBREFERENCES
http://www.oxygensoftware.com
http://www.smsactivex.com
http://www.codeguru.com
Source Code
MDI FORM
A Tool for Using MS Access as a Multimedia Database 57
-
8/3/2019 Main Document Ion
58/100
Imports System.Windows.Forms
PublicClass MDI
PrivateSub ShowNewForm(ByVal sender AsObject, ByVal e AsEventArgs) Handles NewToolStripMenuItem.Click
Dim find AsNew frm_findfind.MdiParent = Mefind.Show()
EndSub
PrivateSub SaveToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) HandlesSaveToolStripMenuItem.Click Dim insert AsNew Form1
insert.MdiParent = Meinsert.Show()
EndSub
PrivateSub MDI_Load(ByVal sender As System.Object, ByVal eAs System.EventArgs) HandlesMyBase.Load EndSub
PrivateSub OpenToolStripMenuItem_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesOpenToolStripMenuItem.Click Dim convert AsNew frm_convert
convert.MdiParent = Meconvert.Show()
EndSub
PrivateSub DeleteImageToolStripMenuItem_Click(ByVal senderAs System.Object, ByVal e As System.EventArgs) HandlesDeleteImageToolStripMenuItem.Click
A Tool for Using MS Access as a Multimedia Database 58
-
8/3/2019 Main Document Ion
59/100
Dim delete AsNew frm_deldelete.MdiParent = Medelete.Show()
EndSub
PrivateSub SaveAsToolStripMenuItem_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesSaveAsToolStripMenuItem.Click Dim extract AsNew frm_extract
extract.MdiParent = Meextract.Show()
EndSub
PrivateSub InsertAudioToolStripMenuItem_Click(ByVal sender
As System.Object, ByVal e As System.EventArgs) HandlesInsertAudioToolStripMenuItem.Click Dim inserta AsNew frm_insa
inserta.MdiParent = Meinserta.Show()
EndSub
PrivateSub ExtractAudioToolStripMenuItem_Click(ByVal senderAs System.Object, ByVal e As System.EventArgs) Handles
ExtractAudioToolStripMenuItem.Click Dim extracta AsNew frm_extracta
extracta.MdiParent = Meextracta.Show()
EndSub
PrivateSub DeleteAudioToolStripMenuItem_Click(ByVal senderAs System.Object, ByVal e As System.EventArgs) HandlesDeleteAudioToolStripMenuItem.Click Dim deletea AsNew frm_dela
deletea.MdiParent = Medeletea.Show()
EndSub
A Tool for Using MS Access as a Multimedia Database 59
-
8/3/2019 Main Document Ion
60/100
PrivateSub InsertVideoToolStripMenuItem_Click(ByVal senderAs System.Object, ByVal e As System.EventArgs) HandlesInsertVideoToolStripMenuItem.Click Dim insertv AsNew frm_insv
insertv.MdiParent = Me
insertv.Show()
EndSub
PrivateSub ExtractVideoToolStripMenuItem_Click(ByVal senderAs System.Object, ByVal e As System.EventArgs) HandlesExtractVideoToolStripMenuItem.Click Dim extractv AsNew frm_extractv
extractv.MdiParent = Meextractv.Show()
EndSub
PrivateSub DeleteVideoToolStripMenuItem_Click(ByVal senderAs System.Object, ByVal e As System.EventArgs) HandlesDeleteVideoToolStripMenuItem.Click Dim deletev AsNew frm_delv
deletev.MdiParent = Medeletev.Show()
EndSub
PrivateSub ExitToolStripMenuItem_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesExitToolStripMenuItem.Click Me.Close()
EndSubEndClass
A Tool for Using MS Access as a Multimedia Database 60
-
8/3/2019 Main Document Ion
61/100
FIND FORM
Imports System.Data.OleDbImports System.IO
PublicClass frm_find Inherits System.Windows.Forms.Form Dim conn AsNewSystem.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Replace(Application.StartupPath, "bin","") & "DB.mdb;") PrivateSub frm_find_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) HandlesMyBase.Load Me.MdiParent = MDI EndSub PrivateSub DrawToScale(ByVal img As Image)
PictureBox1.Image = New Bitmap(img) EndSub PrivateSub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click OnErrorGoTo fix Dim fn AsString = TextBox1.Text
Dim sql AsString = "SELECT Photo FROM Images WHEREFileName='" & fn & "'"conn.Open()
Dim cmd As OleDbCommand = New OleDbCommand(sql,conn) Dim b() AsByte
b = cmd.ExecuteScalar() Ifb IsNothingThen
MsgBox("No Image Found")TextBox1.Text = ""
ElseIf(b.Length > 0)Then Dim stream AsNew MemoryStream(b,True)
stream.Write(b, 0, b.Length)DrawToScale(New Bitmap(stream))stream.Close()
EndIfconn.Close()
A Tool for Using MS Access as a Multimedia Database 61
-
8/3/2019 Main Document Ion
62/100
fix: ExitSub EndSubEndClass
COMPRESS FORM
Imports System.IOImports System.Data.OleDb
PublicClass frm_convert Dim conn AsNew
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Replace(Application.StartupPath, "bin","") & "DB.mdb;Mode=ReadWrite;Persist Security Info=False")
PrivateSub Form1_Load(ByVal sender As System.Object, ByVale As System.EventArgs) HandlesMyBase.Load Me.MdiParent = MDI EndSub
PrivateSub JPGToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) HandlesJPGToolStripMenuItem.Click OnErrorResumeNext With OpenFileDialog1
.CheckFileExists =True
.FileName = "*.JPG"
.AddExtension =True
.DefaultExt = "*.JPG"
.ShowDialog()PictureBox1.Image = New
System.Drawing.Bitmap(.FileName)PictureBox1.SizeMode =
PictureBoxSizeMode.StretchImage EndWith EndSub
A Tool for Using MS Access as a Multimedia Database 62
-
8/3/2019 Main Document Ion
63/100
PrivateSub BMPToolStripMenuItem_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesBMPToolStripMenuItem.Click OnErrorResumeNext Dim d AsNew
System.Drawing.Bitmap(Module1.compress(PictureBox1)) Dim tmp AsString = OpenFileDialog1.FileName() IfPictureBox1.SizeMode = PictureBoxSizeMode.NormalThen My.Computer.Audio.Play("C:\Windows\Media\ringin.wav")
MsgBox("Open a picture!") ExitSub EndIf
SaveFileDialog1.ShowDialog()tmp = SaveFileDialog1.FileNamed.Save(tmp, System.Drawing.Imaging.ImageFormat.Bmp)
Dim answer As MsgBoxResult Ifanswer = MsgBoxResult.YesThen
MsgBox("Image Saved") EndIf EndSub
PrivateSub ToujoursVisibleToolStripMenuItem_Click(ByValsender As System.Object, ByVal e As System.EventArgs) OnErrorResumeNext With OpenFileDialog1
.CheckFileExists =True
.FileName = "*.ICO"
.AddExtension =True
.DefaultExt = "*.ICO"
.ShowDialog()PictureBox1.Image = New
System.Drawing.Bitmap(.FileName)PictureBox1.SizeMode =
PictureBoxSizeMode.StretchImage EndWith
EndSub
PrivateSub BMPToolStripMenuItem1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) OnErrorResumeNext Dim d AsNew System.Drawing.Bitmap(PictureBox1.Image)
A Tool for Using MS Access as a Multimedia Database 63
-
8/3/2019 Main Document Ion
64/100
-
8/3/2019 Main Document Ion
65/100
PrivateSub ICOToolStripMenuItem_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesICOToolStripMenuItem.Click OnErrorResumeNext With OpenFileDialog1
.CheckFileExists =True
.FileName = "*.BMP"
.AddExtension =True
.DefaultExt = "*.BMP"
.ShowDialog()PictureBox1.Image = New
System.Drawing.Bitmap(.FileName)PictureBox1.SizeMode =
PictureBoxSizeMode.StretchImage EndWith
EndSub
PrivateSub JPGToolStripMenuItem1_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesJPGToolStripMenuItem1.Click OnErrorResumeNext Dim d AsNewSystem.Drawing.Bitmap(Module1.compress(PictureBox1)) Dim tmp AsString = OpenFileDialog1.FileName() IfPictureBox1.SizeMode = PictureBoxSizeMode.NormalThen
My.Computer.Audio.Play("C:\Windows\Media\ringin.wav")MsgBox("Open a picture!")
ExitSub EndIf
SaveFileDialog2.ShowDialog()tmp = SaveFileDialog2.FileNamed.Save(tmp, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim answer As MsgBoxResult Ifanswer = MsgBoxResult.YesThen
MsgBox("Image Saved")
EndIf EndSub
PrivateSub ToujoursVisibleToolStripMenuItem1_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) HandlesToujoursVisibleToolStripMenuItem1.Click
A Tool for Using MS Access as a Multimedia Database 65
-
8/3/2019 Main Document Ion
66/100
Me.TopMost = Not (Me.TopMost) EndSub
PrivateSub SauverJPGToolStripMenuItem_Click(ByVal senderAs System.Object, ByVal e As System.EventArgs)
OnErrorResumeNext Dim d AsNew System.Drawing.Bitmap(PictureBox1.Image) Dim tmp AsString = OpenFileDialog1.FileName() IfPictureBox1.SizeMode = PictureBoxSizeMode.NormalThen My.Computer.Audio.Play("C:\Windows\Media\ringin.wav")
MsgBox("Open a picture!") ExitSub EndIf
tmp = Microsoft.VisualBasic.Replace(UCase(tmp), "ICO","JPG")
d.Save(tmp, System.Drawing.Imaging.ImageFormat.Jpeg) Dim answer As MsgBoxResult
answer = MsgBox("Save in JPG in the file of origin." &vbNewLine & "You finished?", MsgBoxStyle.YesNo) Ifanswer = MsgBoxResult.YesThen
MsgBox("See you soon") End EndIf EndSub
PrivateSub SauverBMPToolStripMenuItem_Click(ByVal senderAs System.Object, ByVal e As System.EventArgs) OnErrorResumeNext Dim d AsNew System.Drawing.Bitmap(PictureBox1.Image) Dim tmp AsString = OpenFileDialog1.FileName() IfPictureBox1.SizeMode = PictureBoxSizeMode.NormalThen My.Computer.Audio.Play("C:\Windows\Media\ringin.wav")
MsgBox("Open a picture!") ExitSub EndIf
tmp = Microsoft.VisualBasic.Replace(UCase(tmp), "ICO","BMP")
d.Save(tmp, System.Drawing.Imaging.ImageFormat.Bmp) Dim answer As MsgBoxResult
answer = MsgBox("Save in BMP in the file of origin." &vbNewLine & "You finished?", MsgBoxStyle.YesNo) Ifanswer = MsgBoxResult.YesThen
A Tool for Using MS Access as a Multimedia Database 66
-
8/3/2019 Main Document Ion
67/100
MsgBox("See you soon") End EndIf EndSubEndClass
INSERT IMAGE FORM
Imports System.Data.OleDbImports System.IO
PublicClass Form1 Inherits System.Windows.Forms.Form Dim conn AsNew
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Replace(Application.StartupPath, "bin","") & "DB.mdb;Mode=ReadWrite;Persist Security Info=False")
PrivateSub Button1_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles Button1.Click OnErrorGoTo fix
OpenFileDialog1.ShowDialog()PictureBox1.Image =
Image.FromFile(OpenFileDialog1.FileName)
fix: ExitSub EndSub
PrivateSub Button3_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button3.Click Dim fAsInteger = 0 OnErrorGoTo fix Dim fs As FileStream = NewFileStream(OpenFileDialog1.FileName, FileMode.Open,
FileAccess.Read) Dim s AsString = TextBox1.Text Dim r As BinaryReader = New BinaryReader(fs) Dim FileByteArray(fs.Length - 1) AsByte
r.Read(FileByteArray, 0, CInt(fs.Length)) Dim sql AsString = "INSERT INTO Images (Filename,Photo)VALUES (?,?)"
A Tool for Using MS Access as a Multimedia Database 67
-
8/3/2019 Main Document Ion
68/100
Dim cmd AsNew System.Data.OleDb.OleDbCommand(sql,conn)
cmd.Parameters.Add("@Filename",System.Data.OleDb.OleDbType.VarChar).Value = TextBox1.Text
cmd.Parameters.Add("@Photo",
System.Data.OleDb.OleDbType.Binary).Value = FileByteArrayconn.Open()cmd.ExecuteNonQuery()MessageBox.Show("Image Succesfully inserted !", "Image
Save and Read", MessageBoxButtons.OK,MessageBoxIcon.Information)
conn.Close()f = 1
fix: Iff = 0Then
MsgBox("Already the image name exists; Please enteranother name")
TextBox1.Text = "" EndIf ExitSub EndSub
PrivateSub DrawToScale(ByVal img As Image)PictureBox1.Image = New Bitmap(img)
EndSub
PrivateSub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button2.Click OnErrorGoTo fix Dim fn AsString = InputBox("Enter File Name:") Dim sql AsString = "SELECT Photo FROM Images WHEREFileName='" & fn & "'"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,conn)
TextBox1.Text = fn Dim b() AsByte
b = cmd.ExecuteScalar() If(b.Length > 0)Then Dim stream AsNew MemoryStream(b,True)
stream.Write(b, 0, b.Length)DrawToScale(New Bitmap(stream))
A Tool for Using MS Access as a Multimedia Database 68
-
8/3/2019 Main Document Ion
69/100
stream.Close() EndIf
conn.Close()fix: ExitSub
EndSub
PrivateSub Button4_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button4.Click Me.Hide() EndSub
PrivateSub Button5_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button5.Click OnErrorGoTo fix
Dim fn AsString = InputBox("Enter name to delete") Dim sql AsString = "DELETE FROM Images WHEREFileName='" & fn & "'"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,conn)
cmd.ExecuteNonQuery()MessageBox.Show("Image Succesfully deleted !", "Image
Save and Read", MessageBoxButtons.OK,MessageBoxIcon.Information)
conn.Close()fix: ExitSub EndSub
PrivateSub Form1_Load(ByVal sender As System.Object, ByVale As System.EventArgs) HandlesMyBase.Load Me.MdiParent = MDI EndSubEndClass
EXTRACT IMAGE FORM
A Tool for Using MS Access as a Multimedia Database 69
-
8/3/2019 Main Document Ion
70/100
Imports System.Data.OleDbImports System.IOPublicClass frm_extract Dim conn AsNew
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Replace(Application.StartupPath, "bin","") & "DB.mdb;Mode=ReadWrite;Persist Security Info=False") PrivateSub ComboBox1_GotFocus(ByVal sender AsObject,ByVal e As System.EventArgs) Handles ComboBox1.GotFocus
ComboBox1.Items.Clear() OnErrorGoTo fix Dim sql AsString = "SELECT FileName FROM Images"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,
conn) Dim dr As OleDbDataReader = cmd.ExecuteReader While dr.Read
ComboBox1.Items.Add(dr.GetValue(0).ToString()) EndWhile
dr.Close()conn.Close()
fix: ExitSub EndSub
PrivateSub ComboBox1_SelectedIndexChanged(ByVal senderAs System.Object, ByVal e As System.EventArgs) HandlesComboBox1.SelectedIndexChanged OnErrorGoTo fix Dim fn AsString = ComboBox1.SelectedItem.ToString Dim sql AsString = "SELECT Photo FROM Images WHEREFileName='" & fn & "'"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,conn)
Dim b() AsByteb = cmd.ExecuteScalar()
If(b.Length > 0)Then Dim stream AsNew MemoryStream(b,True)
stream.Write(b, 0, b.Length)DrawToScale(New Bitmap(stream))stream.Close()
A Tool for Using MS Access as a Multimedia Database 70
-
8/3/2019 Main Document Ion
71/100
EndIfconn.Close()
fix: ExitSub EndSub
PrivateSub DrawToScale(ByVal img As Image)PictureBox1.Image = New Bitmap(img)
EndSub PrivateSub frm_extract_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) HandlesMyBase.Load Me.MdiParent = MDI EndSub
PrivateSub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click
IfSaveFileDialog1.ShowDialog() Windows.Forms.DialogResult.CancelThen Dim d AsNewSystem.Drawing.Bitmap(PictureBox1.Image) Dim tmp AsString = SaveFileDialog1.FileName
d.Save(tmp, System.Drawing.Imaging.ImageFormat.Bmp)MsgBox("file saved")
EndIf EndSubEndClass
DELETE IMAGE FORM
Imports System.Data.OleDbImports System.IO
PublicClass frm_del Inherits System.Windows.Forms.Form Dim conn AsNew
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Replace(Application.StartupPath, "bin","") & "DB.mdb;Mode=ReadWrite;Persist Security Info=False") PrivateSub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click IfMsgBox(" Are you sure you want to delete the image ? ",MsgBoxStyle.YesNo) = MsgBoxResult.YesThen
A Tool for Using MS Access as a Multimedia Database 71
-
8/3/2019 Main Document Ion
72/100
OnErrorGoTo mfix Dim fn AsString = ComboBox1.SelectedItem.ToString Dim Sql AsString = "DELETE FROM Images WHEREFileName='" & Trim(fn) & "'"
conn.Open()
Dim cmd As OleDbCommand = New OleDbCommand(Sql,conn)
cmd.ExecuteNonQuery()MessageBox.Show("Image Succesfully deleted !", "Image
Save and Read", MessageBoxButtons.OK,MessageBoxIcon.Information)
PictureBox1.Image = Image.FromFile("c:\emp.bmp")ComboBox1.Text = ""conn.Close()
Else
PictureBox1.Image = Image.FromFile("C:\emp.bmp") EndIfmfix: ExitSub EndSub PrivateSub DrawToScale(ByVal img As Image)
PictureBox1.Image = New Bitmap(img) EndSub PrivateSub frm_del_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) HandlesMyBase.Load
Me.MdiParent = MDI EndSub PrivateSub ComboBox1_GotFocus(ByVal sender AsObject,ByVal e As System.EventArgs) Handles ComboBox1.GotFocus
ComboBox1.Items.Clear() OnErrorGoTo fix Dim sql AsString = "SELECT FileName FROM Images"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,conn)
Dim dr As OleDbDataReader = cmd.ExecuteReader While dr.Read
ComboBox1.Items.Add(dr.GetValue(0).ToString()) EndWhile
dr.Close()conn.Close()
fix:
A Tool for Using MS Access as a Multimedia Database 72
-
8/3/2019 Main Document Ion
73/100
ExitSub EndSub
PrivateSub ComboBox1_SelectedIndexChanged(ByVal senderAs System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged OnErrorGoTo fix Dim fn AsString = ComboBox1.SelectedItem.ToString Dim sql AsString = "SELECT Photo FROM Images WHEREFileName='" & fn & "'"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,conn) Dim b() AsByte
b = cmd.ExecuteScalar()
If(b.Length > 0)Then Dim stream AsNew MemoryStream(b,True)
stream.Write(b, 0, b.Length)DrawToScale(New Bitmap(stream))stream.Close()
EndIfconn.Close()
fix: ExitSub EndSub
EndClass
INSERT AUDIO FORM
Imports System.Data.OleDbImports System.IOPublicClass frm_insa Dim conn AsNewSystem.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OL
EDB.4.0;Data Source=" & Replace(Application.StartupPath, "bin","") & "DB.mdb;Mode=ReadWrite;Persist Security Info=False") PrivateSub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click OnErrorGoTo fix
OpenFileDialog1.ShowDialog()mp.openPlayer(OpenFileDialog1.FileName.ToString)
A Tool for Using MS Access as a Multimedia Database 73
-
8/3/2019 Main Document Ion
74/100
fix: EndSub
PrivateSub frm_insa_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) HandlesMyBase.Load
Me.MdiParent = MDI EndSub
PrivateSub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button2.Click Dim fAsBoolean = False OnErrorGoTo fix Dim fs As FileStream = NewFileStream(OpenFileDialog1.FileName, FileMode.Open,FileAccess.Read)
Dim s AsString = TextBox1.Text Dim r As BinaryReader = New BinaryReader(fs) Dim FileByteArray(fs.Length - 1) AsByte
r.Read(FileByteArray, 0, CInt(fs.Length)) Dim sql AsString = "INSERT INTO audio (Filename,audio)VALUES (?,?)" Dim cmd AsNew System.Data.OleDb.OleDbCommand(sql,conn)
cmd.Parameters.Add("@Filename",System.Data.OleDb.OleDbType.VarChar).Value = TextBox1.Text
cmd.Parameters.Add("@audio",System.Data.OleDb.OleDbType.Binary).Value = FileByteArray
conn.Open()cmd.ExecuteNonQuery()MessageBox.Show("Audio Succesfully inserted !", "Image
Save and Read", MessageBoxButtons.OK,MessageBoxIcon.Information)
conn.Close()f =True
fix:
Iff = FalseThenMsgBox("Already the audio name exists; Please enter
another name") EndIf
TextBox1.Text = "" ExitSub EndSub
A Tool for Using MS Access as a Multimedia Database 74
-
8/3/2019 Main Document Ion
75/100
EndClass
EXTRACT AUDIO FORM
Imports System.Data.OleDbImports System.IOPublicClass frm_extracta Dim conn AsNewSystem.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Replace(Application.StartupPath, "bin","") & "DB.mdb;Mode=ReadWrite;Persist Security Info=False") PrivateSub ComboBox1_GotFocus(ByVal sender AsObject,ByVal e As System.EventArgs) Handles ComboBox1.GotFocus
ComboBox1.Items.Clear() OnErrorGoTo fix Dim sql AsString = "SELECT FileName FROM audio"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,conn) Dim dr As OleDbDataReader = cmd.ExecuteReader While dr.Read
ComboBox1.Items.Add(dr.GetValue(0).ToString()) EndWhile
dr.Close()conn.Close()
fix: ExitSub EndSub
PrivateSub ComboBox1_SelectedIndexChanged(ByVal senderAs System.Object, ByVal e As System.EventArgs) HandlesComboBox1.SelectedIndexChanged OnErrorGoTo fix
Dim fn AsString = ComboBox1.SelectedItem.ToString Dim sql AsString = "SELECT audio FROM audio WHEREFileName='" & fn & "'"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,conn) Dim b() AsByte
A Tool for Using MS Access as a Multimedia Database 75
-
8/3/2019 Main Document Ion
76/100
b = cmd.ExecuteScalar() If(b.Length > 0)Then Dim stream AsNew MemoryStream(b,True) Dim fs As FileStream = New FileStream("C:\x.wav",FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(b, 0, b.Length)fs.Close()mp.openPlayer("C:\x.wav")
EndIfconn.Close()
fix: ExitSub EndSub
PrivateSub frm_extracta_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) HandlesMyBase.Load Me.MdiParent = MDI EndSub
PrivateSub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click IfSaveFileDialog1.ShowDialog() Windows.Forms.DialogResult.CancelThen Dim pt AsString = SaveFileDialog1.FileName
File.Copy("c:\x.wav", pt,True)
ElseComboBox1.Text = ""
EndIf EndSubEndClass
DELETE AUDIO FORM
Imports System.Data.OleDbImports System.IOPublicClass frm_dela Dim conn AsNewSystem.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OL
A Tool for Using MS Access as a Multimedia Database 76
-
8/3/2019 Main Document Ion
77/100
EDB.4.0;Data Source=" & Replace(Application.StartupPath, "bin","") & "DB.mdb;Mode=ReadWrite;Persist Security Info=False")
PrivateSub ComboBox1_GotFocus(ByVal sender AsObject,ByVal e As System.EventArgs) Handles ComboBox1.GotFocus
ComboBox1.Items.Clear() OnErrorGoTo fix Dim sql AsString = "SELECT FileName FROM audio"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,conn) Dim dr As OleDbDataReader = cmd.ExecuteReader While dr.Read
ComboBox1.Items.Add(dr.GetValue(0).ToString()) EndWhile
dr.Close()conn.Close()
fix: ExitSub EndSub PrivateSub ComboBox1_SelectedIndexChanged(ByVal senderAs System.Object, ByVal e As System.EventArgs) HandlesComboBox1.SelectedIndexChanged OnErrorGoTo fix Dim fn AsString = ComboBox1.SelectedItem.ToString
Dim sql AsString = "SELECT audio FROM audio WHEREFileName='" & fn & "'"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,conn) Dim b() AsByte
b = cmd.ExecuteScalar() If(b.Length > 0)Then Dim stream AsNew MemoryStream(b,True) Dim fs As FileStream = New FileStream("C:\x.wav",
FileMode.OpenOrCreate, FileAccess.Write)fs.Write(b, 0, b.Length)fs.Close()mp.openPlayer("C:\x.wav")
EndIfconn.Close()
fix:
A Tool for Using MS Access as a Multimedia Database 77
-
8/3/2019 Main Document Ion
78/100
ExitSub EndSub
PrivateSub frm_dela_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) HandlesMyBase.Load
Me.MdiParent = MDI EndSub
PrivateSub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click IfMsgBox(" Are you sure you want to delete the audio ? ",MsgBoxStyle.YesNo) = MsgBoxResult.YesThen OnErrorGoTo mfix Dim fn AsString = Trim(ComboBox1.Text) Dim Sql AsString = "DELETE FROM audio WHERE
FileName='" & Trim(fn) & "'"conn.Open()
Dim cmd As OleDbCommand = New OleDbCommand(Sql,conn)
cmd.ExecuteNonQuery()MessageBox.Show("Audio Succesfully deleted !", "Audio
Delete Confirmation", MessageBoxButtons.OK,MessageBoxIcon.Information)
ComboBox1.Text = ""conn.Close()
ElseComboBox1.Text = ""
EndIfmfix: ExitSub EndSubEndClass
INSERT VIDEO FORM
Imports System.Data.OleDbImports System.IOPublicClass frm_insv Dim conn AsNewSystem.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OL
A Tool for Using MS Access as a Multimedia Database 78
-
8/3/2019 Main Document Ion
79/100
EDB.4.0;Data Source=" & Replace(Application.StartupPath, "bin","") & "DB.mdb;Mode=ReadWrite;Persist Security Info=False") PrivateSub frm_insv_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) HandlesMyBase.Load Me.MdiParent = MDI
EndSub
PrivateSub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click OnErrorGoTo fix
OpenFileDialog1.ShowDialog()mp.openPlayer(OpenFileDialog1.FileName)
fix: EndSub
PrivateSub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button2.Click Dim fAsBoolean = False OnErrorGoTo fix Dim fs As FileStream = NewFileStream(OpenFileDialog1.FileName, FileMode.Open,FileAccess.Read) Dim s AsString = TextBox1.Text Dim r As BinaryReader = New BinaryReader(fs) Dim FileByteArray(fs.Length - 1) AsByte
r.Read(FileByteArray, 0, CInt(fs.Length)) Dim sql AsString = "INSERT INTO video (Filename,video)VALUES (?,?)" Dim cmd AsNew System.Data.OleDb.OleDbCommand(sql,conn)
cmd.Parameters.Add("@Filename",System.Data.OleDb.OleDbType.VarChar).Value = TextBox1.Text
cmd.Parameters.Add("@video",System.Data.OleDb.OleDbType.Binary).Value = FileByteArray
conn.Open()
cmd.ExecuteNonQuery()MessageBox.Show("video Succesfully inserted !", "Image
Save and Read", MessageBoxButtons.OK,MessageBoxIcon.Information)
conn.Close()f =True
fix:
A Tool for Using MS Access as a Multimedia Database 79
-
8/3/2019 Main Document Ion
80/100
Iff = FalseThenMsgBox("Already the video name exists; Please enter
another name") EndIf
TextBox1.Text = ""
ExitSub EndSubEndClass
EXTRACT VIDEO FORM
Imports System.Data.OleDbImports System.IOPublicClass frm_extractv Dim conn AsNew
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Replace(Application.StartupPath, "bin","") & "DB.mdb;Mode=ReadWrite;Persist Security Info=False") PrivateSub frm_extractv_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) HandlesMyBase.Load Me.MdiParent = MDI EndSub
PrivateSub ComboBox1_GotFocus(ByVal sender AsObject,ByVal e As System.EventArgs) Handles ComboBox1.GotFocus
ComboBox1.Items.Clear() OnErrorGoTo fix Dim sql AsString = "SELECT FileName FROM video"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,conn) Dim dr As OleDbDataReader = cmd.ExecuteReader While dr.Read
ComboBox1.Items.Add(dr.GetValue(0).ToString()) EndWhile
dr.Close()conn.Close()
fix: ExitSub EndSub
A Tool for Using MS Access as a Multimedia Database 80
-
8/3/2019 Main Document Ion
81/100
PrivateSub ComboBox1_SelectedIndexChanged(ByVal senderAs System.Object, ByVal e As System.EventArgs) HandlesComboBox1.SelectedIndexChanged OnErrorGoTo fix Dim fn AsString = ComboBox1.SelectedItem.ToString
Dim sql AsString = "SELECT video FROM video WHEREFileName='" & fn & "'"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,conn) Dim b() AsByte
b = cmd.ExecuteScalar() If(b.Length > 0)Then Dim stream AsNew MemoryStream(b,True) Dim fs As FileStream = New FileStream("C:\x.avi",
FileMode.OpenOrCreate, FileAccess.Write)fs.Write(b, 0, b.Length)fs.Close()mp.openPlayer("C:\x.avi")
EndIfconn.Close()
fix: ExitSub EndSub
PrivateSub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click IfSaveFileDialog1.ShowDialog() Windows.Forms.DialogResult.CancelThen Dim pt AsString = SaveFileDialog1.FileName
File.Copy("c:\x.avi", pt,True) Else
ComboBox1.Text = "" EndIf EndSub
EndClass
DELETE VIDEO FORM
A Tool for Using MS Access as a Multimedia Database 81
-
8/3/2019 Main Document Ion
82/100
Imports System.Data.OleDbImports System.IOPublicClass frm_delv Dim conn AsNew
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Replace(Application.StartupPath, "bin","") & "DB.mdb;Mode=ReadWrite;Persist Security Info=False") PrivateSub frm_delv_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) HandlesMyBase.Load Me.MdiParent = MDI EndSub
PrivateSub ComboBox1_GotFocus(ByVal sender AsObject,ByVal e As System.EventArgs) Handles ComboBox1.GotFocus
OnErrorGoTo fixComboBox1.Items.Clear()
Dim sql AsString = "SELECT FileName FROM video"conn.Open()
Dim cmd As OleDbCommand = New OleDbCommand(sql,conn) Dim dr As OleDbDataReader = cmd.ExecuteReader While dr.Read
ComboBox1.Items.Add(dr.GetValue(0).ToString()) EndWhile
dr.Close()conn.Close()
fix: ExitSub EndSub
PrivateSub ComboBox1_SelectedIndexChanged(ByVal senderAs System.Object, ByVal e As System.EventArgs) HandlesComboBox1.SelectedIndexChanged OnErrorGoTo fix
Dim fn AsString = ComboBox1.SelectedItem.ToString Dim sql AsString = "SELECT video FROM video WHEREFileName='" & fn & "'"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(sql,conn) Dim b() AsByte
A Tool for Using MS Access as a Multimedia Database 82
-
8/3/2019 Main Document Ion
83/100
b = cmd.ExecuteScalar() If(b.Length > 0)Then Dim stream AsNew MemoryStream(b,True) Dim fs As FileStream = New FileStream("C:\x.avi",FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(b, 0, b.Length)fs.Close()mp.openPlayer("C:\x.avi")
EndIfconn.Close()
fix: ExitSub EndSub
PrivateSub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click IfMsgBox(" Are you sure you want to delete the video ? ",MsgBoxStyle.YesNo) = MsgBoxResult.YesThen OnErrorGoTo mfix Dim fn AsString = Trim(ComboBox1.Text) Dim Sql AsString = "DELETE FROM video WHEREFileName='" & Trim(fn) & "'"
conn.Open() Dim cmd As OleDbCommand = New OleDbCommand(Sql,conn)
cmd.ExecuteNonQuery()MessageBox.Show("video Succesfully deleted !", "video
Delete Confirmation", MessageBoxButtons.OK,MessageBoxIcon.Information)
ComboBox1.Text = ""conn.Close()
ElseComboBox1.Text = ""
EndIfmfix:
ExitSub EndSubEndClass
A Tool for Using MS Access as a Multimedia Database 83
-
8/3/2019 Main Document Ion
84/100
MODULE
Module Module1 PublicFunction compress(ByVal img AsSystem.Windows.Forms.PictureBox) As System.Drawing.Bitmap
Shell("C:\MAIN-C.exe temp.bmp temp.jpg")
Return img.Image
EndFunction
PublicFunction decompress(ByVal img AsSystem.Windows.Forms.PictureBox) As System.Drawing.Bitmap
Shell("C:\MAIN-E.exe temp.jpg temp.bmp")
Return img.Image EndFunctionEndModule
DCT.C
#include#include#include#include"bitio.h"#include"errhand.h"#define ROWS 200#define COLS 320
#define N 8
#define ROUND(a) (((a)
-
8/3/2019 Main Document Ion
85/100
void Initalize(int quality);void ReadPixelStrip(FILE*input,unsigned char strip[N][COLS]);int InputCode(BIT_FILE*input);void ReadDCTData(BIT_FILE*input,int input_data[N][N]);void OutputCode(BIT_FILE*output_file,int code);
void WriteDCTData(BIT_FILE*output_file,int output_data[N][N]);void WritePixelStrip(FILE*output,unsigned char strip[N][COLS]);void ForwardDCT(unsigned char*input[N],int output[N][N]);void InverseDCT(int input[N][N],unsigned char*output[N]);void CompressFile(FILE*input,BIT_FILE*output,intargc,char*argv[]);void ExpandFile(BIT_FILE*input,FILE*output,int argc,char*argv[]);#elsevoid Initalize();void ReadPixelStrip();
int InputCode();void ReadDCTData();void OutputCode();void WriteDCTData();void WritePixelStrip();void Forward();void CompressFile();void ExpandFile();#endifunsigned char PixelStrip[N][COLS];
double c[N][N];doublect[N][N];int InputRunLength;int OutputRunLength;int Quantum[N][N];
struct zigzag{int row;int col;}zigzag[N*N]={
{0,0},
{0,1},{1,0},{2,0},{1,1},{0,2},{0,3},{1,2},{2,1},{3,0},{4,0},{3,1},{2,2},{1,3},{0,4},{0,5},{1,4},{2,3},{3,2},{4,1},{5,0},{6,0},{5,1},{4,2},{3,3},{2,4},{1,5},{0,6},
A Tool for Using MS Access as a Multimedia Database 85
-
8/3/2019 Main Document Ion
86/100
{0,7},{1,6},{2,5},{3,4},{4,3},{5,2},{6,1},{7,0},
{7,1},{6,2},{5,3},{4,4},{3,5},{2,6},1,7},{2,7},{3,6},{4,5},{5,4},{6,3},{7,2},{7,3},{6,4},{5,5},{4,6},{3,7},
{4,7},{5,6},{6,5},{7,4},{7,5},{6,6},{5,7},[6,7},{7,6},{7,7}};
void Initalize(quality)int quality;{ int i;
int j;
double pi=atan(1.0)*4.0;for(i=0;i
-
8/3/2019 Main Document Ion
87/100
strip[row][col]=(unsigned char)c;} }
int InputCode(input_file)BIT_FILE*input_file;{
int bit_count;int result;if(InputRunLength>0){InputRunLength--;return(0);
}bit_count=(int)InputBits(input_file,2);if(bit_count==0){InputRunLength=(int)InputBits(input_file,4);return(0);
}if(bit_count==1){InputRunLength=(int)InputBits(input_file,1)+1;elsebit_count=(int)InputBits(input_file,2)+(bit_count
-
8/3/2019 Main Document Ion
88/100
int top_of_range;int abs_code;int bit_count;if(code==0){OutputRunLength++;
return;}if(OutputRunLength!=0){while(OutputRunLength>0){OutputBits(output_file,0l,2);if(OutputRunLength
-
8/3/2019 Main Document Ion
89/100
void WriteDCTData(output_file,output_data)BIT_FILE*output_file;
int output_data[N][N];{int i;
int row;int col;double result;for(i=0;i
-
8/3/2019 Main Document Ion
90/100
for(i=0;i
-
8/3/2019 Main Document Ion
91/100
int row;int col;int i;unsigned char*input_array[N];int output_array[N][N];
int quality;if(argc-->0)
quality=atoi(argv[0]);elsequality=3;
if(quality50)fatal_error("Illegal quality factor of%d\n",quality);printf("Using quality factor of%d\n",quality);Initialize(quality);OutputBits(output,(unsigned long)quality,8);
for(row=0;row
-
8/3/2019 Main Document Ion
92/100
Initialize(quality);for(row=0;rowrack=0;
bit_file->mask=0*80;bit_file->pacifier_counter=0;return(bit_file);}BIT_FILE*OpenInputBitFile (name)
Char*name;{
A Tool for Using MS Access as a Multimedia Database 92
-
8/3/2019 Main Document Ion
93/100
BIT_FILE*bit_file;bit_file= (BIT_FILE*) calloc (1, sizeof (BIT_FILE));if (bit_file==NULL)return(bit_file);bit_file->file=fopen(name,"rb");
bit_file->rack=0;bit_file->mask=0*80;bit file->pacifier counter=0;Return(bit_file);}void CloseOutputBitFile(bit_file)BIT_FILE*bit_file;{if(bit_file->mask!=0*80)if(putc(b