summaryrefslogtreecommitdiff
path: root/libswscale
diff options
context:
space:
mode:
authorMartin Vignali <martin.vignali@gmail.com>2018-08-20 15:28:00 +0200
committerMartin Vignali <martin.vignali@gmail.com>2018-08-22 11:36:09 +0200
commit3af1c4ea7d18c54738cd93f09b376d2228fdbce0 (patch)
tree4500d2a78adc7554d76d337f517b8421338e95a0 /libswscale
parent900487043b6e531fe3edf8c8d38288ef915f6f25 (diff)
swscale : treat float input data as uint 16bpc
Currently float are converted to 16b uint in input part using src depth (32 bits) in hScale16To19 and hScale16to15, make an invalid shift for the data So shift the value when using float input like 16 bpc uint.
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/swscale.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 7f3e22355f..3ae16bef7d 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -74,8 +74,11 @@ static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW,
int bits = desc->comp[0].depth - 1;
int sh = bits - 4;
- if((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16)
+ if ((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
sh= 9;
+ } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
+ sh = 16 - 1 - 4;
+ }
for (i = 0; i < dstW; i++) {
int j;
@@ -99,8 +102,11 @@ static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW,
const uint16_t *src = (const uint16_t *) _src;
int sh = desc->comp[0].depth - 1;
- if(sh<15)
+ if (sh<15) {
sh= isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1);
+ } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
+ sh = 16 - 1;
+ }
for (i = 0; i < dstW; i++) {
int j;