Skip to content

Commit

Permalink
Add XYZ12LE to vapoursynth
Browse files Browse the repository at this point in the history
  • Loading branch information
dnjulek authored and Asd-g committed Feb 28, 2024
1 parent e24e13f commit c6543b9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions VapourSynth/lwlibav_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,22 @@ static const VSFrameRef *VS_CC vs_filter_get_frame( int n, int activation_reason
bottom = ( vohp->frame_order_list[n].bottom == vohp->frame_order_list[frame_number].bottom ) ? vohp->frame_order_list[n - 1].bottom :
vohp->frame_order_list[n].bottom;
}
if ( vohp->scaler.output_pixel_format == AV_PIX_FMT_XYZ12LE )
{
const int pitch = vsapi->getStride(vs_frame, output_index) / 2;
uint16_t* as_frame_ptr = (uint16_t*)(vsapi->getWritePtr(vs_frame, output_index));
for ( int y = 0; y < vsapi->getFrameHeight(vs_frame, output_index); ++y )
{
for ( int x = 0; x < pitch; x += 3 )
{
const uint16_t temp = as_frame_ptr[x];
as_frame_ptr[x] = as_frame_ptr[x + 2];
as_frame_ptr[x + 2] = temp;
}

as_frame_ptr += pitch;
}
}
set_frame_properties( vi, av_frame, vdhp->format->streams[vdhp->stream_index], vs_frame, top, bottom, vsapi, n );
return vs_frame;
}
Expand Down
2 changes: 2 additions & 0 deletions VapourSynth/video_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ static const component_reorder_t *get_component_reorder( enum AVPixelFormat av_o
{ AV_PIX_FMT_RGBA64LE, { 0, 1, 2, 3 } },
{ AV_PIX_FMT_BGRA64LE, { 2, 1, 0, 3 } },
{ AV_PIX_FMT_RGBA64BE, { 0, 1, 2, 3 | component_reorder_bigendian } },
{ AV_PIX_FMT_XYZ12LE, { 0, 1, 2, -1 } },
{ AV_PIX_FMT_NONE, { 0, 1, 2, 3 } }
};
int i = 0;
Expand Down Expand Up @@ -649,6 +650,7 @@ static int determine_colorspace_conversion
{ AV_PIX_FMT_RGBA64LE, pfRGB48, 1 },
{ AV_PIX_FMT_BGRA64LE, pfRGB48, 1 },
{ AV_PIX_FMT_RGBA64BE, pfRGB48, 1 },
{ AV_PIX_FMT_XYZ12LE, pfRGB48, 1 },
{ AV_PIX_FMT_NONE, pfNone, 1 }
};
if( vs_vohp->variable_info || vs_vohp->vs_output_pixel_format == pfNone )
Expand Down

1 comment on commit c6543b9

@Asd-g
Copy link
Contributor

@Asd-g Asd-g commented on c6543b9 Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#56

Please sign in to comment.