mbox series

[raw2rgbpnm,0/3] Add support for multi plane formats with strides

Message ID 20250312191710.1823147-1-niklas.soderlund@ragnatech.se
Headers show
Series Add support for multi plane formats with strides | expand

Message

Niklas Söderlund March 12, 2025, 7:17 p.m. UTC
Hi Sakari,

This series extends raw2rgbpnm to correctly handle NV16 (and friends) 
source frames where the image stride do not exactly match the source 
width. Without this fix the utility process the source frame into a 
output frame that is corrupted without printing any warnings. This could 
lead to someone (not me obviously...) spending time debugging issues 
around this and slowly go mad ;-)

The first two patches prepare for adding support for handling multi 
planer formats by removing odd features which would be hard to rework to 
support it. Once the cleanup is done the new feature is straight 
forward.

Patch 1/3 remove support for reading multiple frames from a single file.  
This feature might have been useful at some point. But in 2012 a type in 
refactoring lead to it being disabled and impossible to use. I recently 
fixed this as I noticed the typo in while exploring another area of the 
tool. I think we can assume if nobody noticed the feature was gone for 
13+ years there are few users of it?

Patch 2/3 removes support from guessing from a small list of sizes if no 
size was given as a CLI argument. This too might have been useful at 
some point, but the list of resolutions to guess are not kept 
up-to-date. Few modern standard resolution are part of the list, while 
really odd ones are. Anyone remember the standard resolution 2592x1968 
commented as '5 MP + a bit extra' ? ;-) As guessing stuff is dangerous 
remove this feature. This feature could possibly be reworked to be kept 
around if there truly is a user of it.

I have done good tests of this centered around NV16 and rudamentary 
tests around NV12. Apart from the removed features I have not spotted 
any regressions and after this multi planer formats with stride > width 
works as expected.

Niklas Söderlund (3):
  Remove support for reading multiple frames from single file
  Remove guessing of source image size
  Add support for multi plane formats with stride

 raw2rgbpnm.c | 345 +++++++++++++++++++++++----------------------------
 1 file changed, 156 insertions(+), 189 deletions(-)