Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

JPEG Transcoding - Lossless Rotate and Mirror
JPEG Group has a utility called "jpegtran" which can rotate and mirror JPG
pictures without quality loss.  An online version of this application can
be found here:

http://sylvana.net/jpeg-lab.html

I know how to arrange the quantization tables and DCTs in a JPG file to
swap the top-right and lower-left corner of a picture, but I can not
figure out how to do any other lossless rotate and mirror functions.

I am looking for the algorithms that make these other manipulations
possible.  I do not know C well enough to understand JPEG Group's source
code, and would prefer an explanation in plain english.

Any help would be appreciated.  Thanks.

-korejwa

Report this thread to moderator Post Follow-up to this message
Old Post
Korejwa
09-18-04 01:55 PM


Re: JPEG Transcoding - Lossless Rotate and Mirror
On Sat, 18 Sep 2004, Korejwa wrote:

> I know how to arrange the quantization tables and DCTs in a JPG file to
> swap the top-right and lower-left corner of a picture, but I can not
> figure out how to do any other lossless rotate and mirror functions.
>
> I am looking for the algorithms that make these other manipulations
> possible.  I do not know C well enough to understand JPEG Group's source
> code, and would prefer an explanation in plain english.

If you know how you mirror horizontally, vertically and across the
diagonal axis you can also rotate in 90° steps.

Suppose that you have the DCT coefficients available as
coeff(i,j) for i,j=0..7, i being "the x frequency" and
j being the "y frequency"

Mirroring at the diagonal axis:
new_coeffs(i,j) = coeff(j,i)

Swapping left/right:
new_coeffs(i,j) = coeffs(i,j) * sign_adjust1(i,j)
where sign_adjust(i,j) is 1 for even i and -1 for odd i

Swapping up/down
is similar to swapping left/right except that sign_adjust
depends on j

90° clockwise rotation would be
- swap at diagonal axis
- swap left/right

90° counter clockwise rotation would be
- swap at diagonal axis
- swap up/down

The elements of the quantization tables have to be swapped in
the same way. Now the only thing left is to encode your file.


> Any help would be appreciated.  Thanks.
>
> -korejwa


HTH,
Sebastian

--
PGP-Key-ID (long): 572B1778A4CA0707


Report this thread to moderator Post Follow-up to this message
Old Post
Sebastian Gesemann
09-18-04 01:55 PM


Re: JPEG Transcoding - Lossless Rotate and Mirror
Thanks a million Sebastian!

I've put quite a few hours into this, and I'm now able to do all the
possible transforms based on the information you've given me.  I can't
thank you enough!

-korejwa

On Sat, 18 Sep 2004 14:37:35 +0200, Sebastian Gesemann <isnt@valid.net>
wrote:

> On Sat, 18 Sep 2004, Korejwa wrote:
> 
>
> If you know how you mirror horizontally, vertically and across the
> diagonal axis you can also rotate in 90° steps.
>
> Suppose that you have the DCT coefficients available as
> coeff(i,j) for i,j=0..7, i being "the x frequency" and
> j being the "y frequency"
>
> Mirroring at the diagonal axis:
> new_coeffs(i,j) = coeff(j,i)
>
> Swapping left/right:
> new_coeffs(i,j) = coeffs(i,j) * sign_adjust1(i,j)
> where sign_adjust(i,j) is 1 for even i and -1 for odd i
>
> Swapping up/down
> is similar to swapping left/right except that sign_adjust
> depends on j
>
> 90° clockwise rotation would be
> - swap at diagonal axis
> - swap left/right
>
> 90° counter clockwise rotation would be
> - swap at diagonal axis
> - swap up/down
>
> The elements of the quantization tables have to be swapped in
> the same way. Now the only thing left is to encode your file.
>
> 
>
>
> HTH,
> Sebastian
>
> --
> PGP-Key-ID (long): 572B1778A4CA0707
>

Report this thread to moderator Post Follow-up to this message
Old Post
Korejwa
09-22-04 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Compression archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:09 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.