... | ... |
@@ -133,46 +133,46 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame) |
133 | 133 |
frame->video->top_field_first == s->dst_tff) |
134 | 134 |
return ff_filter_frame(outlink, frame); |
135 | 135 |
|
136 |
- av_dlog(ctx, |
|
137 |
- "picture will move %s one line\n", |
|
138 |
- s->dst_tff ? "up" : "down"); |
|
139 |
- h = frame->video->h; |
|
140 |
- for (plane = 0; plane < 4 && frame->data[plane]; plane++) { |
|
141 |
- line_step = frame->linesize[plane]; |
|
142 |
- line_size = s->line_size[plane]; |
|
143 |
- data = frame->data[plane]; |
|
144 |
- if (s->dst_tff) { |
|
145 |
- /** Move every line up one line, working from |
|
146 |
- * the top to the bottom of the frame. |
|
147 |
- * The original top line is lost. |
|
148 |
- * The new last line is created as a copy of the |
|
149 |
- * penultimate line from that field. */ |
|
150 |
- for (line = 0; line < h; line++) { |
|
151 |
- if (1 + line < frame->video->h) { |
|
152 |
- memcpy(data, data + line_step, line_size); |
|
153 |
- } else { |
|
154 |
- memcpy(data, data - line_step - line_step, line_size); |
|
155 |
- } |
|
156 |
- data += line_step; |
|
136 |
+ av_dlog(ctx, |
|
137 |
+ "picture will move %s one line\n", |
|
138 |
+ s->dst_tff ? "up" : "down"); |
|
139 |
+ h = frame->video->h; |
|
140 |
+ for (plane = 0; plane < 4 && frame->data[plane]; plane++) { |
|
141 |
+ line_step = frame->linesize[plane]; |
|
142 |
+ line_size = s->line_size[plane]; |
|
143 |
+ data = frame->data[plane]; |
|
144 |
+ if (s->dst_tff) { |
|
145 |
+ /** Move every line up one line, working from |
|
146 |
+ * the top to the bottom of the frame. |
|
147 |
+ * The original top line is lost. |
|
148 |
+ * The new last line is created as a copy of the |
|
149 |
+ * penultimate line from that field. */ |
|
150 |
+ for (line = 0; line < h; line++) { |
|
151 |
+ if (1 + line < frame->video->h) { |
|
152 |
+ memcpy(data, data + line_step, line_size); |
|
153 |
+ } else { |
|
154 |
+ memcpy(data, data - line_step - line_step, line_size); |
|
157 | 155 |
} |
158 |
- } else { |
|
159 |
- /** Move every line down one line, working from |
|
160 |
- * the bottom to the top of the frame. |
|
161 |
- * The original bottom line is lost. |
|
162 |
- * The new first line is created as a copy of the |
|
163 |
- * second line from that field. */ |
|
164 |
- data += (h - 1) * line_step; |
|
165 |
- for (line = h - 1; line >= 0 ; line--) { |
|
166 |
- if (line > 0) { |
|
167 |
- memcpy(data, data - line_step, line_size); |
|
168 |
- } else { |
|
169 |
- memcpy(data, data + line_step + line_step, line_size); |
|
170 |
- } |
|
171 |
- data -= line_step; |
|
156 |
+ data += line_step; |
|
157 |
+ } |
|
158 |
+ } else { |
|
159 |
+ /** Move every line down one line, working from |
|
160 |
+ * the bottom to the top of the frame. |
|
161 |
+ * The original bottom line is lost. |
|
162 |
+ * The new first line is created as a copy of the |
|
163 |
+ * second line from that field. */ |
|
164 |
+ data += (h - 1) * line_step; |
|
165 |
+ for (line = h - 1; line >= 0 ; line--) { |
|
166 |
+ if (line > 0) { |
|
167 |
+ memcpy(data, data - line_step, line_size); |
|
168 |
+ } else { |
|
169 |
+ memcpy(data, data + line_step + line_step, line_size); |
|
172 | 170 |
} |
171 |
+ data -= line_step; |
|
173 | 172 |
} |
174 | 173 |
} |
175 |
- frame->video->top_field_first = s->dst_tff; |
|
174 |
+ } |
|
175 |
+ frame->video->top_field_first = s->dst_tff; |
|
176 | 176 |
|
177 | 177 |
return ff_filter_frame(outlink, frame); |
178 | 178 |
} |