Closed
Bug 967962
Opened 12 years ago
Closed 12 years ago
[Camera] Preview size too small in Nexus 4
Categories
(Firefox OS Graveyard :: Gaia::Camera, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: dmarcos, Assigned: dmarcos)
Details
Attachments
(1 file)
Our algorithm to calculate the best preview size from the list provided by hardware is not returning the best match on Nexus 4.
Steps to reproduce:
1. Open the camera app
2. The selected preview doesn't cover the whole screen.
Expected:
A preview that fills the whole screen
| Assignee | ||
Comment 1•12 years ago
|
||
Attachment #8370473 -
Flags: review?(dflanagan)
| Assignee | ||
Updated•12 years ago
|
OS: Mac OS X → Gonk (Firefox OS)
Hardware: x86 → PowerPC
Comment 2•12 years ago
|
||
If someone with a Nexus 4 can post the values returned from mozCamera.capabilities.previewSizes as well as the dimensions of the display, I can update the unit tests with a better sample of test data.
| Assignee | ||
Comment 3•12 years ago
|
||
This is the list I get:
[{"width":1280,"height":720},{"width":800,"height":480},{"width":768,"height":432},{"width":720,"height":480},{"width":640,"height":480},{"width":576,"height":432},{"width":480,"height":320},{"width":384,"height":288},{"width":352,"height":288},{"width":320,"height":240},{"width":240,"height":160},{"width":176,"height":144}]
| Assignee | ||
Comment 4•12 years ago
|
||
The viewportSize passed to the selectOptimalPreviewSize function is:
{"width":1180,"height":768}
Comment 5•12 years ago
|
||
On other devices, I'm pretty sure that width/height are reversed compared to Nexus 4?
| Assignee | ||
Comment 6•12 years ago
|
||
The selected size by the algorithm is:
{"width":720,"height":480}
| Assignee | ||
Comment 7•12 years ago
|
||
This is the list returned by hamachi:
[{"height":480,"width":640},{"height":432,"width":576},{"height":320,"width":480},{"height":240,"width":432},{"height":288,"width":384},{"height":288,"width":352},{"height":240,"width":320},{"height":160,"width":240},{"height":144,"width":176}]
width > height
Comment 8•12 years ago
|
||
Here's the calculation's internal results for Nexus4:
[{
"previewSize": {
"width": 1280,
"height": 720
},
"pw": 1365.3333333333333,
"ph": 768,
"scale": 1.0666666666666667,
"overflow": 142336
}, {
"previewSize": {
"width": 800,
"height": 480
},
"pw": 1280,
"ph": 768,
"scale": 1.6,
"overflow": 76800
}, {
"previewSize": {
"width": 768,
"height": 432
},
"pw": 1365.3333333333333,
"ph": 768,
"scale": 1.7777777777777777,
"overflow": 142336
}, {
"previewSize": {
"width": 720,
"height": 480
},
"pw": 1180,
"ph": 786.6666666666666,
"scale": 1.6388888888888888,
"overflow": 22026.666666666628
}, {
"previewSize": {
"width": 640,
"height": 480
},
"pw": 1180,
"ph": 885,
"scale": 1.84375,
"overflow": 138060
}, {
"previewSize": {
"width": 576,
"height": 432
},
"pw": 1180,
"ph": 885,
"scale": 2.048611111111111,
"overflow": 138060
}, {
"previewSize": {
"width": 480,
"height": 320
},
"pw": 1180,
"ph": 786.6666666666667,
"scale": 2.4583333333333335,
"overflow": 22026.666666666744
}, {
"previewSize": {
"width": 384,
"height": 288
},
"pw": 1180,
"ph": 885,
"scale": 3.0729166666666665,
"overflow": 138060
}, {
"previewSize": {
"width": 352,
"height": 288
},
"pw": 1180,
"ph": 965.4545454545454,
"scale": 3.352272727272727,
"overflow": 232996.36363636353
}, {
"previewSize": {
"width": 320,
"height": 240
},
"pw": 1180,
"ph": 885,
"scale": 3.6875,
"overflow": 138060
}, {
"previewSize": {
"width": 240,
"height": 160
},
"pw": 1180,
"ph": 786.6666666666667,
"scale": 4.916666666666667,
"overflow": 22026.666666666744
}, {
"previewSize": {
"width": 176,
"height": 144
},
"pw": 1180,
"ph": 965.4545454545454,
"scale": 6.704545454545454,
"overflow": 232996.36363636353
}]
Comment 9•12 years ago
|
||
According to what the algorithm is doing, it is technically picking the "correct" size based on the following criteria:
- Smallest overflow (22026.666666666628)
- Scale closest to 1.0 (1.6388888888888888)
Testing with the Nexus4 numbers, however, it is clear that the algorithm needs to compensate for a margin of error with regards to rounding of the overflow number. Based on what the algorithm of CameraUtils.selectOptimalPreviewSize() is supposed to do, we should end up with 3 acceptable sizes:
- 720x480 (Scale: 1.6388888888888888)
- 480x320 (Scale: 2.4583333333333335)
- 240x160 (Scale: 4.916666666666667)
All three of these sizes (when scaled) yield the least amount of overflow (22026.66...). The one that is then picked from these three is the one with the scale that is closest to 1.0 (720x480).
Comment 10•12 years ago
|
||
Updated PR to also include updated test data for the CameraUtils unit test. I added real-world preview sizes/viewfinder sizes for Hamachi, Helix and Nexus 4.
Updated•12 years ago
|
Attachment #8370473 -
Flags: review?(dflanagan) → review?(dmarcos)
| Assignee | ||
Updated•12 years ago
|
Attachment #8370473 -
Flags: review?(dmarcos) → review+
| Assignee | ||
Comment 11•12 years ago
|
||
Thanks for the thorough testing Justin
| Assignee | ||
Comment 12•12 years ago
|
||
| Assignee | ||
Updated•12 years ago
|
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•12 years ago
|
Assignee: nobody → dmarcos
You need to log in
before you can comment on or make changes to this bug.
Description
•