@@ -94,29 +94,14 @@ static int pass_append(SwsGraph *graph, enum AVPixelFormat fmt, int w, int h,
94
94
return 0 ;
95
95
}
96
96
97
- static int vshift (enum AVPixelFormat fmt , int plane )
98
- {
99
- const AVPixFmtDescriptor * desc = av_pix_fmt_desc_get (fmt );
100
- return (plane == 1 || plane == 2 ) ? desc -> log2_chroma_h : 0 ;
101
- }
102
-
103
- /* Shift an image vertically by y lines */
104
- static SwsImg shift_img (const SwsImg * img_base , int y )
105
- {
106
- SwsImg img = * img_base ;
107
- for (int i = 0 ; i < 4 && img .data [i ]; i ++ )
108
- img .data [i ] += (y >> vshift (img .fmt , i )) * img .linesize [i ];
109
- return img ;
110
- }
111
-
112
97
static void run_copy (const SwsImg * out_base , const SwsImg * in_base ,
113
98
int y , int h , const SwsPass * pass )
114
99
{
115
- SwsImg in = shift_img (in_base , y );
116
- SwsImg out = shift_img (out_base , y );
100
+ SwsImg in = ff_sws_img_shift (in_base , y );
101
+ SwsImg out = ff_sws_img_shift (out_base , y );
117
102
118
103
for (int i = 0 ; i < FF_ARRAY_ELEMS (out .data ) && out .data [i ]; i ++ ) {
119
- const int lines = h >> vshift (in .fmt , i );
104
+ const int lines = h >> ff_fmt_vshift (in .fmt , i );
120
105
av_assert1 (in .data [i ]);
121
106
122
107
if (in .linesize [i ] == out .linesize [i ]) {
@@ -219,7 +204,7 @@ static void run_legacy_unscaled(const SwsImg *out, const SwsImg *in_base,
219
204
{
220
205
SwsContext * sws = slice_ctx (pass , y );
221
206
SwsInternal * c = sws_internal (sws );
222
- const SwsImg in = shift_img (in_base , y );
207
+ const SwsImg in = ff_sws_img_shift (in_base , y );
223
208
224
209
c -> convert_unscaled (c , (const uint8_t * const * ) in .data , in .linesize , y , h ,
225
210
out -> data , out -> linesize );
@@ -230,7 +215,7 @@ static void run_legacy_swscale(const SwsImg *out_base, const SwsImg *in,
230
215
{
231
216
SwsContext * sws = slice_ctx (pass , y );
232
217
SwsInternal * c = sws_internal (sws );
233
- const SwsImg out = shift_img (out_base , y );
218
+ const SwsImg out = ff_sws_img_shift (out_base , y );
234
219
235
220
ff_swscale (c , (const uint8_t * const * ) in -> data , in -> linesize , 0 ,
236
221
sws -> src_h , out .data , out .linesize , y , h );
@@ -490,8 +475,8 @@ static void run_lut3d(const SwsImg *out_base, const SwsImg *in_base,
490
475
int y , int h , const SwsPass * pass )
491
476
{
492
477
SwsLut3D * lut = pass -> priv ;
493
- const SwsImg in = shift_img (in_base , y );
494
- const SwsImg out = shift_img (out_base , y );
478
+ const SwsImg in = ff_sws_img_shift (in_base , y );
479
+ const SwsImg out = ff_sws_img_shift (out_base , y );
495
480
496
481
ff_sws_lut3d_apply (lut , in .data [0 ], in .linesize [0 ], out .data [0 ],
497
482
out .linesize [0 ], pass -> width , h );
0 commit comments