[FFmpeg-devel] New filter: remap?

F.Sluiter fsluiter at gmail.com
Fri Feb 26 00:10:20 CET 2016


So not color mapping (that would be another awesome filter indeed) but
location mapping....

2016-02-25 23:42 GMT+01:00 F.Sluiter <fsluiter at gmail.com>:

> I am not considering a format change (yet), maybe I wasn't clear enough on
> how this filter would work.
> Displace works now with a image stream and two in puts, x_displacement,
> y_dispacement. x and y are relative so they are added to the x,y location
> of the source pixel.  the pixel x,y currently being copied ends up at
> (x+displacement_x,y+displacement_y).
> However, my remap filter would do and absolute "displacement" or rather
> "remap", ampping from source pixels to target pixels.
> so the x,y found in the second and third input would determine which
> source pixel is copied to the current location.The filter would be almost
> similar code to the displace filter but it would copy the source pixel
> directly from the given location in stead of displacing it with a relative
> value..
> pseudo code:
>
> /*displace*/
> inputimage source[][];
> input displace_x[][];
> input displace_y[][];
> output target[][];
>
> for (int i; i <max_i;i++){
>   for int j; j<max_j;j++){
>     target[i+displace_x[i][j]][j+displace_y[i][j]] = source[i][j];
> }}
>
> /*remap*/
> inputimage source[][];
> input remap_x[][];
> input remap_y[][];
> output target[][];
>
> for (int i; i <max_i;i++){
>   for int j; j<max_j;j++){
>     target[i][j] = source[remap_x[i][j]][remap_y[i][j]];
> }}
>
> It might sound trivial, but with "remap" the target can be for example
> bigger or with a different aspect ratio, and remap_x,remap_y would just
> tell you were the pixels are coming from. So the same pixel from the source
> could be copied multiple times to different locations in the target. With
> displace, you can move a pixel only once.... It is "Push" vs "Pull".
>
>
> 2016-02-25 23:06 GMT+01:00 Paul B Mahol <onemda at gmail.com>:
>
>> On 2/25/16, F.Sluiter <fsluiter at gmail.com> wrote:
>> > Could you actually be more specific, what would be needed for 16bit
>> > support? I was naively thinking to just a binary copy from source pixel
>> to
>> > target for starters.
>>
>> For example, first input is 8bit depth and 2nd and 3rd are 16bit depth
>> so remap works for > 256 dimensions.
>>
>> Maybe you want to work with nonsubsampled formats only and not have option
>> to remap y/u/v differently from each other?
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
>


More information about the ffmpeg-devel mailing list