Hi,
I’m using the Resizer Hardware module of DaVinci for resizing to a particular resolution.
I’m not using the Resizer driver, rather I have put in a piece of code to directly calculate the hrsz, vrsz, input_width, output_width and configure the appropriate registers.
I initially used the ti_davinci_resizer.pdf as the reference and calculated the above values based on the formulas in the document and observed a hardware hang.
So based on my observations I took an approach deviating from the ti_davinci_resizer document and it worked fine. Can anyone give a confirmation whether my approach is right?
ti_davinci_resizer document:
To ensure consistent sizing, the DaVinci_resizer document says that hrsz and
vrsz needs to be calculated using the below formula
hrsz = floor(((in_width - 4) *256)/(ow-1))
vrsz = floor(((in_height - 4) *256)/(oh-1))
in_width and the in_height are original width and height for the input image.
Once hrsz and vrsz values are calculated using above equations, they must be applied below equation to calculate iw and ih values
iw = (32 * sph + (ow -1) * hrsz + 16) >> 8 + 7
ih = (32 *spv + (oh - 1) * vrsz + 16) >> 8 + 4
sph and spv are considere to be equal to zero.
When the above said approach was followed, I observed hardware hang because of the inconsistent values of input height and output height in regards to the scaling factor for vertical directions.
So based on my observations I took the following approach deviating from the ti_davinci_resizer document.
My approach:
The hrsz and vrsz values are calculated based on the formula provided in the davinci resizer document.
After calculating hrsz and vrsz, I calculated iw and ih based on hrsz and vrsz respectively.
Now we need to choose iw and calculate temp_hrsz again with the above formula without floor such that we obtain a value of temp_hrsz greatest in the range
hrsz < temp_hrsz < (hrsz+1)
temp_hrsz = ((iw - 4) *256)/(ow-1)
Similarly we need to choose ih and calculate temp_vrsz without floor such that we obtain a value of temp_vrsz greatest in the range
vrsz < temp_vrsz < (vrsz+1) (temp_vrsz is a floating point value)
temp_vrsz = ((ih - 4) *256)/(oh-1)
This approach provided a consistent input and output sizes with regards to the scaling factor, for both horizontal and vertical directions.
Comparison:
iw and ih calculations:
Approach |
Input Resolution |
Output Resolution |
iw |
ih |
HRSZ |
VRSZ |
Comment |
Davinci document |
352x240 |
704x240 |
353 |
239 |
126 |
126 |
Hardware hang |
My approach |
352x240 |
704x240 |
353 |
241 |
126 |
126 |
Works fine |
I am using the calcoef for generating filter coefficients in both approaches.
Can anyone comment whether my approach is correct or suggest what is that I have missed while calculating which makes the hardware to hang.
Thanks in advance.