#3739 closed enhancement (worksforme)
support bitand functions > 8 bit
Reported by: | dericed | Owned by: | |
---|---|---|---|
Priority: | wish | Component: | avutil |
Version: | git-master | Keywords: | bitand |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the enhancement request:
bitand (and bitor) operations function at 8 bit, I'd like to use bitand to work with the lower bits of some 10 and 16 bit video but it seems that bitand only finangles the first 8 bits.
Here is a command I would use to solo the 8th bit of the Y plane. I would like to do similarly with lower bits.
bit=8 ffplay 10bit_v210.mov -vf "extractplanes=y,lut=c0=bitand(val\,pow(2\,8-${bit}))*pow(2\,${bit})"
Change History (7)
comment:1 follow-up: ↓ 2 Changed 6 years ago by cehoyos
comment:2 in reply to: ↑ 1 Changed 6 years ago by saste
comment:3 Changed 6 years ago by dericed
yuv422p10le
comment:4 Changed 6 years ago by cehoyos
So is this a duplicate of ticket #2475?
comment:5 follow-up: ↓ 7 Changed 6 years ago by dericed
No, ticket #2475 is for supporting >8 bit in lut, while ticket #3739 is for supporting values in bitand/bitor greater than 8 bit. Unfortunately in my example above this would only work if both lut and bitand supported >8 bit.
This uses geq
ffplay -f lavfi "mandelbrot,format=yuv422p10le,geq=lum=bitand(lum(X\,Y)\,128):cb=128:cr=128"
The 128 is 0b10000000, so the result zeros out bits 2-8 while bit 1 is left as it.
ffplay -f lavfi "mandelbrot,format=yuv422p10le,geq=lum=bitand(lum(X\,Y)\,1):cb=128:cr=128"
zeros out bits 1-7 and leaves 8. To normalize this you could multiple the bitand result by 255 to reveal the detail of bit position 8.
ffplay -f lavfi "mandelbrot,format=yuv422p10le,geq=lum=bitand(lum(X\,Y)\,1)*255:cb=128:cr=128"
From here I tried to increase y value of bitand to something >8 bit, such as 512, but realize that geq as well only outputs 8 bit.
comment:6 Changed 6 years ago by cehoyos
- Resolution set to worksforme
- Status changed from new to closed
I tested the following and I believe it shows that bitand does support >8 bit
$ ffmpeg -f lavfi -i testsrc=r=1 -vf "select=bitand(n\, 262144)" -pix_fmt yuvj420p -vframes 1 out.jpg
comment:7 in reply to: ↑ 5 Changed 6 years ago by cehoyos
Replying to dericed:
geq as well only outputs 8 bit.
That wouldn't be a problem: At least in theory, a filter could exist that takes your 10 bit input, applies some calculations (in 10 bit and also with bitand) but outputs only 8 bit.
The problem is that both lut and geq only accept 8 bit input, so a scale filter is always inserted before these filters if the input file is 10 bit (or more).
Is it possible that bitand (and bitor) support > 8 bit but the lut filter does not?
(As you mentioned in ticket #2475.)