[Sony Ericsson Xperia Neo, Pro] frank_harmann:
EDIT: After poking around in the driver code and comparing results of different camera apps, the following seems to be fact:

1. The driver only supports picture format JPEG (at least on its external interface). So ALL camera apps will get a jpeg from the driver.

2. The driver is always using 2x2 chroma subsampling (which is the main reason for the "poor"(?) image quality).

3. The quality of the compression can be adjusted by using the standard API call CameraParamter.setJpegQuality(0-100). The driver default seems to be 85.

4. However, after several testshots i can't make out any visual difference between the shots made with standard or 100% compression. Technically the 100% version uses better huffmann and quantation tables but this doesn't seem to effect the visual quality.

5. libmmjpeg.so is used for compression (an undocumented qcom jpeg lib). I had no success so far getting better results from the lib. There are some functions like "jpege_get_default_config" which seem the perfect place for patching, but i was unable to figure out the meaning of the various parameters.

6. libcald*.so is used for picture processing (image stablizing, postprocessing etc), so this would be the place for manipulations of the postprocessing pipeline.

6. Third party camera apps like "camera360", "camera fx", etc are unable to produce better compression results (though they seem to). In fact, f.e. camera360 is using the standard driver jpeg compression when set to 100% and is reencoding(!!) the jpeg when set to anything less then 100% (which means the jpeg is probably bigger after reencoding but will be never be better as the source was already crippled. Reencoding also can add several new compression artifacts.) They still might be able to produce better pictures by chosing better parameters for wb,ev... though.

7. The reason for "camera not found" with the modded apk was the some missing permissions. I already did a new apk which could be installed side-by-side with the standard app (i renamed the package structure), but until i find some way to get more quality from the driver releasing/maintaining it would be pointless. For the same reason i removed the old apk from the post.

Here is the blueprint to do the mod yourself (f.e. for other roms/devices):

You need apktool, SignApk, zipalign (search via forum).

- Copy system/app/SemcCameraUI.apk to your pc
- Copy system/framework/SemcGenericUxpRes.apk to your pc
- Copy system/framework/framework-res.apk to your pc
- apktool if framework-res.apk
- apktool if SemcGenericUxpRes.apk
- apktool d SemcCameraUI.apk
- find file "CameraController.smali" in extraced folder "SemcCameraUI\smali\com\sonyericsson\android\camera"
- insert these two lines at line 994[2.3.4 stock] (next line after "setRotation")
const/16 v1, 0x64
invoke-virtual {v0, v1}, Landroid/hardware/Camera$Parameters;->setJpegQuality(I)V

- rename the folder camera to cameraX and change all occurences of "com/sonyericsson/android/camera" to "com/sonyericsson/android/cameraX" in all files. Do the same for "com.sonyericcson.android.camera".
- choose a new name for the app (like "Camera 100") and change all references in res/values*/string.xml.
- rename the folder SemcCameraUI to SemcCameraX
- apktool b SemcCameraX
- java -jar SignApk.jar certificate.pem key.pk8 <your new SemcCameraX.apk> signed-SemcCameraX.apk
- zipalign -v 4 signed-SemcCameraX.apk SemcCameraX.apk
- install apk
- transform apk to system app (f.e. using Titanium Backup), otherwise you can't open camera device

APK attached (EDIT: removed)

Example pics:

Stock

JpegSnoopResult:

JPEGsnoop 1.5.2 by Calvin Hass
http://www.impulseadventure.com/photo/
-------------------------------------

Filename: [C:\Dokumente und Einstellungen\games\Eigene Dateien\Dropbox\privat\telefon\stock.JPG]
Filesize: [832205] Bytes

Start Offset: 0x00000000
*** Marker: SOI (xFFD8) ***
OFFSET: 0x00000000

*** Marker: APP1 (xFFE1) ***
OFFSET: 0x00000002
length = 7612
Identifier = [Exif]
Identifier TIFF = 0x[4D4D002A 00000008]
Endian = Motorola (big)
TAG Mark x002A = 0x002A

EXIF IFD0 @ Absolute 0x00000014
Dir Length = 0x000A
[Make ] = "Sony Ericsson"
[Model ] = "MT15i"
[Orientation ] = Row 0: top, Col 0: left
[XResolution ] = 72/1
[YResolution ] = 72/1
[ResolutionUnit ] = Inch
[Software ] = "4.0.1.A.0.283_2d_f200"
[DateTime ] = "2011:10:18 13:07:41"
[YCbCrPositioning ] = Centered
[ExifOffset ] = @ 0x00D4
Offset to Next IFD = 0x00000270

EXIF IFD1 @ Absolute 0x0000027C
Dir Length = 0x0007
[Compression ] = JPEG
[XResolution ] = 72/1
[YResolution ] = 72/1
[ResolutionUnit ] = Inch
[JpegIFOffset ] = @ +0x02DA = @ 0x02E6
[JpegIFByteCount ] = 6874
Offset to Next IFD = 0x00000000

EXIF SubIFD @ Absolute 0x000000E0
Dir Length = 0x0018
[ExposureTime ] = 10/500 s
[FNumber ] = F2.4
[ISOSpeedRatings ] = 160
[ExifVersion ] = 02.20
[DateTimeOriginal ] = "2011:10:18 13:07:41"
[DateTimeDigitized ] = "2011:10:18 13:07:41"
[ComponentsConfiguration ] = [Y Cb Cr .]
[ShutterSpeedValue ] = 564/100
[ExposureBiasValue ] = 0.00 eV
[MeteringMode ] = CenterWeightedAverage
[LightSource ] = unknown
[Flash ] = Flash did not fire
[FocalLength ] = 4 mm
[FlashPixVersion ] = 01.00
[ColorSpace ] = sRGB
[ExifImageWidth ] = 3264
[ExifImageHeight ] = 2448
[ExifInteroperabilityOffset ] = @ 0x0252
[CustomRendered ] = Normal process
[ExposureMode ] = Auto exposure
[WhiteBalance ] = Auto white balance
[DigitalZoomRatio ] = 100/100
[SceneCaptureType ] = Standard
[SubjectDistanceRange ] = 0

EXIF InteropIFD @ Absolute 0x0000025E
Dir Length = 0x0002
[InteroperabilityIndex ] = "R98"
[InteroperabilityVersion ] = 01.00

*** Marker: DQT (xFFDB) ***
Define a Quantization Table.
OFFSET: 0x00001DC0
Table length = 132
----
Precision=8 bits
Destination ID=0 (Luminance)
DQT, Row #0: 4 3 3 4 6 10 13 16
DQT, Row #1: 3 3 4 5 7 15 16 14
DQT, Row #2: 4 3 4 6 10 15 18 15
DQT, Row #3: 4 4 6 8 13 23 21 16
DQT, Row #4: 5 6 10 15 18 28 27 20
DQT, Row #5: 6 9 14 17 21 27 29 24
DQT, Row #6: 13 17 20 23 27 31 31 26
DQT, Row #7: 19 24 25 25 29 26 27 26
Approx quality factor = 86.93 (scaling=26.13 variance=1.22)
----
Precision=8 bits
Destination ID=1 (Chrominance)
DQT, Row #0: 4 5 6 12 26 26 26 26
DQT, Row #1: 5 5 7 17 26 26 26 26
DQT, Row #2: 6 7 15 26 26 26 26 26
DQT, Row #3: 12 17 26 26 26 26 26 26
DQT, Row #4: 26 26 26 26 26 26 26 26
DQT, Row #5: 26 26 26 26 26 26 26 26
DQT, Row #6: 26 26 26 26 26 26 26 26
DQT, Row #7: 26 26 26 26 26 26 26 26
Approx quality factor = 86.91 (scaling=26.18 variance=0.37)

*** Marker: SOF0 (Baseline DCT) (xFFC0) ***
OFFSET: 0x00001E46
Frame header length = 17
Precision = 8
Number of Lines = 2448
Samples per Line = 3264
Image Size = 3264 x 2448
Raw Image Orientation = Landscape
Number of Img components = 3
Component[1]: ID=0x01, Samp Fac=0x22 (Subsamp 1 x 1), Quant Tbl Sel=0x00 (Lum: Y)
Component[2]: ID=0x02, Samp Fac=0x11 (Subsamp 2 x 2), Quant Tbl Sel=0x01 (Chrom: Cb)
Component[3]: ID=0x03, Samp Fac=0x11 (Subsamp 2 x 2), Quant Tbl Sel=0x01 (Chrom: Cr)

*** Marker: SOS (Start of Scan) (xFFDA) ***
OFFSET: 0x00001FFD
Scan header length = 12
Number of img components = 3
Component[1]: selector=0x01, table=0x00
Component[2]: selector=0x02, table=0x11
Component[3]: selector=0x03, table=0x11
Spectral selection = 0 .. 63
Successive approximation = 0x00

*** Decoding SCAN Data ***
OFFSET: 0x0000200B
Scan Decode Mode: Full IDCT (AC + DC)

Scan Data encountered marker 0xFFD9 @ 0x000CB2CB.0

Compression stats:
Compression Ratio: 29.09:1
Bits per pixel: 0.83:1

Huffman code histogram stats:
Huffman Table: (Dest ID: 0, Class: DC)
# codes of length 01 bits: 0 ( 0%)
# codes of length 02 bits: 18575 ( 15%)
# codes of length 03 bits: 91405 ( 73%)
# codes of length 04 bits: 6690 ( 5%)
# codes of length 05 bits: 5345 ( 4%)
# codes of length 06 bits: 2710 ( 2%)
# codes of length 07 bits: 123 ( 0%)
# codes of length 08 bits: 0 ( 0%)
# codes of length 09 bits: 0 ( 0%)
# codes of length 10 bits: 0 ( 0%)
# codes of length 11 bits: 0 ( 0%)
# codes of length 12 bits: 0 ( 0%)
# codes of length 13 bits: 0 ( 0%)
# codes of length 14 bits: 0 ( 0%)
# codes of length 15 bits: 0 ( 0%)
# codes of length 16 bits: 0 ( 0%)

Huffman Table: (Dest ID: 1, Class: DC)
# codes of length 01 bits: 0 ( 0%)
# codes of length 02 bits: 41476 ( 66%)
# codes of length 03 bits: 9744 ( 16%)
# codes of length 04 bits: 5105 ( 8%)
# codes of length 05 bits: 3621 ( 6%)
# codes of length 06 bits: 1970 ( 3%)
# codes of length 07 bits: 474 ( 1%)
# codes of length 08 bits: 34 ( 0%)
# codes of length 09 bits: 0 ( 0%)
# codes of length 10 bits: 0 ( 0%)
# codes of length 11 bits: 0 ( 0%)
# codes of length 12 bits: 0 ( 0%)
# codes of length 13 bits: 0 ( 0%)
# codes of length 14 bits: 0 ( 0%)
# codes of length 15 bits: 0 ( 0%)
# codes of length 16 bits: 0 ( 0%)

Huffman Table: (Dest ID: 0, Class: AC)
# codes of length 01 bits: 0 ( 0%)
# codes of length 02 bits: 365681 ( 44%)
# codes of length 03 bits: 60853 ( 7%)
# codes of length 04 bits: 247142 ( 30%)
# codes of length 05 bits: 77263 ( 9%)
# codes of length 06 bits: 34012 ( 4%)
# codes of length 07 bits: 28448 ( 3%)
# codes of length 08 bits: 9985 ( 1%)
# codes of length 09 bits: 5945 ( 1%)
# codes of length 10 bits: 2962 ( 0%)
# codes of length 11 bits: 1333 ( 0%)
# codes of length 12 bits: 885 ( 0%)
# codes of length 13 bits: 0 ( 0%)
# codes of length 14 bits: 0 ( 0%)
# codes of length 15 bits: 97 ( 0%)
# codes of length 16 bits: 1252 ( 0%)

Huffman Table: (Dest ID: 1, Class: AC)
# codes of length 01 bits: 0 ( 0%)
# codes of length 02 bits: 161579 ( 51%)
# codes of length 03 bits: 41566 ( 13%)
# codes of length 04 bits: 50669 ( 16%)
# codes of length 05 bits: 34863 ( 11%)
# codes of length 06 bits: 16596 ( 5%)
# codes of length 07 bits: 3241 ( 1%)
# codes of length 08 bits: 5403 ( 2%)
# codes of length 09 bits: 3115 ( 1%)
# codes of length 10 bits: 1497 ( 0%)
# codes of length 11 bits: 603 ( 0%)
# codes of length 12 bits: 120 ( 0%)
# codes of length 13 bits: 0 ( 0%)
# codes of length 14 bits: 239 ( 0%)
# codes of length 15 bits: 117 ( 0%)
# codes of length 16 bits: 245 ( 0%)

YCC clipping in DC:
Y component: [<0= 0] [>255= 0]
Cb component: [<0= 0] [>255= 0]
Cr component: [<0= 0] [>255= 0]

RGB clipping in DC:
R component: [<0= 0] [>255= 0]
G component: [<0= 0] [>255= 0]
B component: [<0= 0] [>255= 0]

Average Pixel Luminance (Y):
Y=[119] (range: 0..255)

Brightest Pixel Search:
YCC=[ 1017, -16, -277] RGB=[205,255,251] @ MCU[ 90, 38]

Finished Decoding SCAN Data
Number of RESTART markers decoded: 0
Next position in scan buffer: Offset 0x000CB2CA.2

*** Marker: EOI (End of Image) (xFFD9) ***
OFFSET: 0x000CB2CB

*** Searching Compression Signatures ***

Signature: 01387A14AF75DC6963F040C1239B7DED
Signature (Rotated): 0196457BE1E9E30F00715A3DDE8B160C
File Offset: 0 bytes
Chroma subsampling: 2x2
EXIF Make/Model: OK [Sony Ericsson] [MT15i]
EXIF Makernotes: NONE
EXIF Software: OK [4.0.1.A.0.283_2d_f200]

Modded

JpegSnoopResult:

JPEGsnoop 1.5.2 by Calvin Hass
http://www.impulseadventure.com/photo/
-------------------------------------

Filename: [C:\Dokumente und Einstellungen\games\Eigene Dateien\Dropbox\privat\telefon\modded.JPG]
Filesize: [2360386] Bytes

Start Offset: 0x00000000
*** Marker: SOI (xFFD8) ***
OFFSET: 0x00000000

*** Marker: APP1 (xFFE1) ***
OFFSET: 0x00000002
length = 7550
Identifier = [Exif]
Identifier TIFF = 0x[4D4D002A 00000008]
Endian = Motorola (big)
TAG Mark x002A = 0x002A

EXIF IFD0 @ Absolute 0x00000014
Dir Length = 0x000A
[Make ] = "Sony Ericsson"
[Model ] = "MT15i"
[Orientation ] = Row 0: top, Col 0: left
[XResolution ] = 72/1
[YResolution ] = 72/1
[ResolutionUnit ] = Inch
[Software ] = "4.0.1.A.0.283_2d_f200"
[DateTime ] = "2011:10:18 13:03:54"
[YCbCrPositioning ] = Centered
[ExifOffset ] = @ 0x00D4
Offset to Next IFD = 0x00000270

EXIF IFD1 @ Absolute 0x0000027C
Dir Length = 0x0007
[Compression ] = JPEG
[XResolution ] = 72/1
[YResolution ] = 72/1
[ResolutionUnit ] = Inch
[JpegIFOffset ] = @ +0x02DA = @ 0x02E6
[JpegIFByteCount ] = 6812
Offset to Next IFD = 0x00000000

EXIF SubIFD @ Absolute 0x000000E0
Dir Length = 0x0018
[ExposureTime ] = 10/640 s
[FNumber ] = F2.4
[ISOSpeedRatings ] = 200
[ExifVersion ] = 02.20
[DateTimeOriginal ] = "2011:10:18 13:03:54"
[DateTimeDigitized ] = "2011:10:18 13:03:54"
[ComponentsConfiguration ] = [Y Cb Cr .]
[ShutterSpeedValue ] = 600/100
[ExposureBiasValue ] = 0.00 eV
[MeteringMode ] = CenterWeightedAverage
[LightSource ] = unknown
[Flash ] = Flash did not fire
[FocalLength ] = 4 mm
[FlashPixVersion ] = 01.00
[ColorSpace ] = sRGB
[ExifImageWidth ] = 3264
[ExifImageHeight ] = 2448
[ExifInteroperabilityOffset ] = @ 0x0252
[CustomRendered ] = Normal process
[ExposureMode ] = Auto exposure
[WhiteBalance ] = Auto white balance
[DigitalZoomRatio ] = 100/100
[SceneCaptureType ] = Standard
[SubjectDistanceRange ] = 0

EXIF InteropIFD @ Absolute 0x0000025E
Dir Length = 0x0002
[InteroperabilityIndex ] = "R98"
[InteroperabilityVersion ] = 01.00

*** Marker: DQT (xFFDB) ***
Define a Quantization Table.
OFFSET: 0x00001D82
Table length = 132
----
Precision=8 bits
Destination ID=0 (Luminance)
DQT, Row #0: 1 1 1 1 1 2 3 4
DQT, Row #1: 1 1 1 1 2 3 4 3
DQT, Row #2: 1 1 1 1 2 3 4 3
DQT, Row #3: 1 1 1 2 3 5 5 4
DQT, Row #4: 1 1 2 3 4 7 6 5
DQT, Row #5: 1 2 3 4 5 6 7 6
DQT, Row #6: 3 4 5 5 6 7 7 6
DQT, Row #7: 4 6 6 6 7 6 6 6
Approx quality factor = 96.95 (scaling=6.11 variance=1.09)
----
Precision=8 bits
Destination ID=1 (Chrominance)
DQT, Row #0: 1 1 1 3 6 6 6 6
DQT, Row #1: 1 1 2 4 6 6 6 6
DQT, Row #2: 1 2 3 6 6 6 6 6
DQT, Row #3: 3 4 6 6 6 6 6 6
DQT, Row #4: 6 6 6 6 6 6 6 6
DQT, Row #5: 6 6 6 6 6 6 6 6
DQT, Row #6: 6 6 6 6 6 6 6 6
DQT, Row #7: 6 6 6 6 6 6 6 6
Approx quality factor = 96.99 (scaling=6.01 variance=0.24)

*** Marker: SOF0 (Baseline DCT) (xFFC0) ***
OFFSET: 0x00001E08
Frame header length = 17
Precision = 8
Number of Lines = 2448
Samples per Line = 3264
Image Size = 3264 x 2448
Raw Image Orientation = Landscape
Number of Img components = 3
Component[1]: ID=0x01, Samp Fac=0x22 (Subsamp 1 x 1), Quant Tbl Sel=0x00 (Lum: Y)
Component[2]: ID=0x02, Samp Fac=0x11 (Subsamp 2 x 2), Quant Tbl Sel=0x01 (Chrom: Cb)
Component[3]: ID=0x03, Samp Fac=0x11 (Subsamp 2 x 2), Quant Tbl Sel=0x01 (Chrom: Cr)

*** Marker: SOS (Start of Scan) (xFFDA) ***
OFFSET: 0x00001FBF
Scan header length = 12
Number of img components = 3
Component[1]: selector=0x01, table=0x00
Component[2]: selector=0x02, table=0x11
Component[3]: selector=0x03, table=0x11
Spectral selection = 0 .. 63
Successive approximation = 0x00

*** Decoding SCAN Data ***
OFFSET: 0x00001FCD
Scan Decode Mode: Full IDCT (AC + DC)

Scan Data encountered marker 0xFFD9 @ 0x00240440.0

Compression stats:
Compression Ratio: 10.19:1
Bits per pixel: 2.36:1

Huffman code histogram stats:
Huffman Table: (Dest ID: 0, Class: DC)
# codes of length 01 bits: 0 ( 0%)
# codes of length 02 bits: 4567 ( 4%)
# codes of length 03 bits: 87561 ( 70%)
# codes of length 04 bits: 9569 ( 8%)
# codes of length 05 bits: 8150 ( 7%)
# codes of length 06 bits: 6817 ( 5%)
# codes of length 07 bits: 5323 ( 4%)
# codes of length 08 bits: 2671 ( 2%)
# codes of length 09 bits: 190 ( 0%)
# codes of length 10 bits: 0 ( 0%)
# codes of length 11 bits: 0 ( 0%)
# codes of length 12 bits: 0 ( 0%)
# codes of length 13 bits: 0 ( 0%)
# codes of length 14 bits: 0 ( 0%)
# codes of length 15 bits: 0 ( 0%)
# codes of length 16 bits: 0 ( 0%)

Huffman Table: (Dest ID: 1, Class: DC)
# codes of length 01 bits: 0 ( 0%)
# codes of length 02 bits: 16291 ( 26%)
# codes of length 03 bits: 13190 ( 21%)
# codes of length 04 bits: 13075 ( 21%)
# codes of length 05 bits: 8920 ( 14%)
# codes of length 06 bits: 5109 ( 8%)
# codes of length 07 bits: 3357 ( 5%)
# codes of length 08 bits: 1935 ( 3%)
# codes of length 09 bits: 493 ( 1%)
# codes of length 10 bits: 54 ( 0%)
# codes of length 11 bits: 0 ( 0%)
# codes of length 12 bits: 0 ( 0%)
# codes of length 13 bits: 0 ( 0%)
# codes of length 14 bits: 0 ( 0%)
# codes of length 15 bits: 0 ( 0%)
# codes of length 16 bits: 0 ( 0%)

Huffman Table: (Dest ID: 0, Class: AC)
# codes of length 01 bits: 0 ( 0%)
# codes of length 02 bits: 1073745 ( 47%)
# codes of length 03 bits: 202328 ( 9%)
# codes of length 04 bits: 473414 ( 21%)
# codes of length 05 bits: 235823 ( 10%)
# codes of length 06 bits: 102316 ( 4%)
# codes of length 07 bits: 91894 ( 4%)
# codes of length 08 bits: 43153 ( 2%)
# codes of length 09 bits: 29245 ( 1%)
# codes of length 10 bits: 16204 ( 1%)
# codes of length 11 bits: 6722 ( 0%)
# codes of length 12 bits: 879 ( 0%)
# codes of length 13 bits: 0 ( 0%)
# codes of length 14 bits: 0 ( 0%)
# codes of length 15 bits: 82 ( 0%)
# codes of length 16 bits: 5813 ( 0%)

Huffman Table: (Dest ID: 1, Class: AC)
# codes of length 01 bits: 0 ( 0%)
# codes of length 02 bits: 335655 ( 34%)
# codes of length 03 bits: 167892 ( 17%)
# codes of length 04 bits: 200170 ( 20%)
# codes of length 05 bits: 149402 ( 15%)
# codes of length 06 bits: 63901 ( 7%)
# codes of length 07 bits: 16446 ( 2%)
# codes of length 08 bits: 21831 ( 2%)
# codes of length 09 bits: 14265 ( 1%)
# codes of length 10 bits: 4147 ( 0%)
# codes of length 11 bits: 2228 ( 0%)
# codes of length 12 bits: 271 ( 0%)
# codes of length 13 bits: 0 ( 0%)
# codes of length 14 bits: 881 ( 0%)
# codes of length 15 bits: 689 ( 0%)
# codes of length 16 bits: 744 ( 0%)

YCC clipping in DC:
Y component: [<0= 0] [>255= 0]
Cb component: [<0= 0] [>255= 0]
Cr component: [<0= 0] [>255= 0]

RGB clipping in DC:
R component: [<0= 0] [>255= 0]
G component: [<0= 0] [>255= 0]
B component: [<0= 0] [>255= 0]

Average Pixel Luminance (Y):
Y=[120] (range: 0..255)

Brightest Pixel Search:
YCC=[ 1010, 44, -290] RGB=[202,255,255] @ MCU[ 92, 37]

Finished Decoding SCAN Data
Number of RESTART markers decoded: 0
Next position in scan buffer: Offset 0x00240440.0

*** Marker: EOI (End of Image) (xFFD9) ***
OFFSET: 0x00240440

*** Searching Compression Signatures ***

Signature: 010564D93F295ADB889B91604DC82EE1
Signature (Rotated): 014302FE54745F4DBB58A0D51CDC66BD
File Offset: 0 bytes
Chroma subsampling: 2x2
EXIF Make/Model: OK [Sony Ericsson] [MT15i]
EXIF Makernotes: NONE
EXIF Software: OK [4.0.1.A.0.283_2d_f200]

For me it seems that image quality is slightly improved (less compression artifacts). But there is still some big limitation as the driver seems to use 2x2 chroma subsampling (see http://wwwimpulseadventurecom/photo/chroma-subsampling.html for technical details). I will have to write a little tool to see if the driver is capable of other formats...

Frank