mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
deinterlace: greedyh: Move code from _planar into _planar_plane
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1790>
This commit is contained in:
parent
19ca706fe8
commit
7e16955e4d
1 changed files with 31 additions and 42 deletions
|
@ -718,15 +718,38 @@ greedyh_scanline_C_planar_uv (GstDeinterlaceMethodGreedyH * self,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
deinterlace_frame_di_greedyh_planar_plane (GstDeinterlaceMethodGreedyH * self,
|
deinterlace_frame_di_greedyh_planar_plane (GstDeinterlaceMethodGreedyH * self,
|
||||||
const guint8 * L1, const guint8 * L2, const guint8 * L3, const guint8 * L2P,
|
const GstDeinterlaceField * history, guint history_count,
|
||||||
guint8 * Dest, gint RowStride, gint FieldHeight, gint Pitch, gint InfoIsOdd,
|
GstVideoFrame * outframe, int cur_field_idx, int i,
|
||||||
ScanlineFunction scanline)
|
ScanlineFunction scanline)
|
||||||
{
|
{
|
||||||
|
guint8 *Dest = GST_VIDEO_FRAME_COMP_DATA (outframe, i);
|
||||||
|
gint RowStride = GST_VIDEO_FRAME_COMP_STRIDE (outframe, i);
|
||||||
|
gint FieldHeight = GST_VIDEO_FRAME_COMP_HEIGHT (outframe, i) / 2;
|
||||||
|
gint Pitch = RowStride * 2;
|
||||||
|
const guint8 *L1; // ptr to Line1, of 3
|
||||||
|
const guint8 *L2; // ptr to Line2, the weave line
|
||||||
|
const guint8 *L3; // ptr to Line3
|
||||||
|
const guint8 *L2P; // ptr to prev Line2
|
||||||
|
gint InfoIsOdd;
|
||||||
gint Line;
|
gint Line;
|
||||||
|
|
||||||
|
L1 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 2].frame, i);
|
||||||
|
if (history[cur_field_idx - 2].flags & PICTURE_INTERLACED_BOTTOM)
|
||||||
|
L1 += RowStride;
|
||||||
|
|
||||||
|
L2 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 1].frame, i);
|
||||||
|
if (history[cur_field_idx - 1].flags & PICTURE_INTERLACED_BOTTOM)
|
||||||
|
L2 += RowStride;
|
||||||
|
|
||||||
|
L3 = L1 + Pitch;
|
||||||
|
L2P = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 3].frame, i);
|
||||||
|
if (history[cur_field_idx - 3].flags & PICTURE_INTERLACED_BOTTOM)
|
||||||
|
L2P += RowStride;
|
||||||
|
|
||||||
// copy first even line no matter what, and the first odd line if we're
|
// copy first even line no matter what, and the first odd line if we're
|
||||||
// processing an EVEN field. (note diff from other deint rtns.)
|
// processing an EVEN field. (note diff from other deint rtns.)
|
||||||
|
|
||||||
|
InfoIsOdd = (history[cur_field_idx - 1].flags == PICTURE_INTERLACED_BOTTOM);
|
||||||
if (InfoIsOdd) {
|
if (InfoIsOdd) {
|
||||||
// copy first even line
|
// copy first even line
|
||||||
memcpy (Dest, L1, RowStride);
|
memcpy (Dest, L1, RowStride);
|
||||||
|
@ -882,17 +905,6 @@ deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method,
|
||||||
GstDeinterlaceMethodGreedyH *self = GST_DEINTERLACE_METHOD_GREEDY_H (method);
|
GstDeinterlaceMethodGreedyH *self = GST_DEINTERLACE_METHOD_GREEDY_H (method);
|
||||||
GstDeinterlaceMethodGreedyHClass *klass =
|
GstDeinterlaceMethodGreedyHClass *klass =
|
||||||
GST_DEINTERLACE_METHOD_GREEDY_H_GET_CLASS (self);
|
GST_DEINTERLACE_METHOD_GREEDY_H_GET_CLASS (self);
|
||||||
gint InfoIsOdd;
|
|
||||||
gint RowStride;
|
|
||||||
gint FieldHeight;
|
|
||||||
gint Pitch;
|
|
||||||
const guint8 *L1; // ptr to Line1, of 3
|
|
||||||
const guint8 *L2; // ptr to Line2, the weave line
|
|
||||||
const guint8 *L3; // ptr to Line3
|
|
||||||
const guint8 *L2P; // ptr to prev Line2
|
|
||||||
guint8 *Dest;
|
|
||||||
gint i;
|
|
||||||
ScanlineFunction scanline;
|
|
||||||
|
|
||||||
if (cur_field_idx + 2 > history_count || cur_field_idx < 1) {
|
if (cur_field_idx + 2 > history_count || cur_field_idx < 1) {
|
||||||
GstDeinterlaceMethod *backup_method;
|
GstDeinterlaceMethod *backup_method;
|
||||||
|
@ -910,35 +922,12 @@ deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method,
|
||||||
|
|
||||||
cur_field_idx += 2;
|
cur_field_idx += 2;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
deinterlace_frame_di_greedyh_planar_plane (self, history, history_count,
|
||||||
InfoIsOdd = (history[cur_field_idx - 1].flags == PICTURE_INTERLACED_BOTTOM);
|
outframe, cur_field_idx, 0, klass->scanline_planar_y);
|
||||||
RowStride = GST_VIDEO_FRAME_COMP_STRIDE (outframe, i);
|
deinterlace_frame_di_greedyh_planar_plane (self, history, history_count,
|
||||||
FieldHeight = GST_VIDEO_FRAME_COMP_HEIGHT (outframe, i) / 2;
|
outframe, cur_field_idx, 1, klass->scanline_planar_uv);
|
||||||
Pitch = RowStride * 2;
|
deinterlace_frame_di_greedyh_planar_plane (self, history, history_count,
|
||||||
|
outframe, cur_field_idx, 2, klass->scanline_planar_uv);
|
||||||
if (i == 0)
|
|
||||||
scanline = klass->scanline_planar_y;
|
|
||||||
else
|
|
||||||
scanline = klass->scanline_planar_uv;
|
|
||||||
|
|
||||||
Dest = GST_VIDEO_FRAME_COMP_DATA (outframe, i);
|
|
||||||
|
|
||||||
L1 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 2].frame, i);
|
|
||||||
if (history[cur_field_idx - 2].flags & PICTURE_INTERLACED_BOTTOM)
|
|
||||||
L1 += RowStride;
|
|
||||||
|
|
||||||
L2 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 1].frame, i);
|
|
||||||
if (history[cur_field_idx - 1].flags & PICTURE_INTERLACED_BOTTOM)
|
|
||||||
L2 += RowStride;
|
|
||||||
|
|
||||||
L3 = L1 + Pitch;
|
|
||||||
L2P = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 3].frame, i);
|
|
||||||
if (history[cur_field_idx - 3].flags & PICTURE_INTERLACED_BOTTOM)
|
|
||||||
L2P += RowStride;
|
|
||||||
|
|
||||||
deinterlace_frame_di_greedyh_planar_plane (self, L1, L2, L3, L2P, Dest,
|
|
||||||
RowStride, FieldHeight, Pitch, InfoIsOdd, scanline);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstDeinterlaceMethodGreedyH, gst_deinterlace_method_greedy_h,
|
G_DEFINE_TYPE (GstDeinterlaceMethodGreedyH, gst_deinterlace_method_greedy_h,
|
||||||
|
|
Loading…
Reference in a new issue