Originally committed as revision 26108 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -1616,6 +1616,9 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic) · 1615 unmodified lines | |||
| 1616 | int i, w, h, stride[4]; | 1616 | int i, w, h, stride[4]; |
| 1617 | unsigned edge; | 1617 | unsigned edge; |
| 1618 | 1618 | ||
| 1619 | if (codec->codec->capabilities & CODEC_CAP_NEG_LINESIZES) | ||
| 1620 | perms |= AV_PERM_NEG_LINESIZES; | ||
| 1621 | |||
| 1619 | if(pic->buffer_hints & FF_BUFFER_HINTS_VALID) { | 1622 | if(pic->buffer_hints & FF_BUFFER_HINTS_VALID) { |
| 1620 | if(pic->buffer_hints & FF_BUFFER_HINTS_READABLE) perms |= AV_PERM_READ; | 1623 | if(pic->buffer_hints & FF_BUFFER_HINTS_READABLE) perms |= AV_PERM_READ; |
| 1621 | if(pic->buffer_hints & FF_BUFFER_HINTS_PRESERVE) perms |= AV_PERM_PRESERVE; | 1624 | if(pic->buffer_hints & FF_BUFFER_HINTS_PRESERVE) perms |= AV_PERM_PRESERVE; |
| @@ -197,12 +197,13 @@ int avfilter_config_links(AVFilterContext *filter) · 196 unmodified lines | |||
| 197 | 197 | ||
| 198 | char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) | 198 | char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) |
| 199 | { | 199 | { |
| 200 | snprintf(buf, buf_size, "%s%s%s%s%s", | 200 | snprintf(buf, buf_size, "%s%s%s%s%s%s", |
| 201 | perms & AV_PERM_READ ? "r" : "", | 201 | perms & AV_PERM_READ ? "r" : "", |
| 202 | perms & AV_PERM_WRITE ? "w" : "", | 202 | perms & AV_PERM_WRITE ? "w" : "", |
| 203 | perms & AV_PERM_PRESERVE ? "p" : "", | 203 | perms & AV_PERM_PRESERVE ? "p" : "", |
| 204 | perms & AV_PERM_REUSE ? "u" : "", | 204 | perms & AV_PERM_REUSE ? "u" : "", |
| 205 | perms & AV_PERM_REUSE2 ? "U" : ""); | 205 | perms & AV_PERM_REUSE2 ? "U" : "", |
| 206 | perms & AV_PERM_NEG_LINESIZES ? "n" : ""); | ||
| 206 | return buf; | 207 | return buf; |
| 207 | } | 208 | } |
| 208 | 209 | ||
| @@ -360,15 +361,17 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 151 unmodified lines | |||
| 360 | { | 361 | { |
| 361 | void (*start_frame)(AVFilterLink *, AVFilterBufferRef *); | 362 | void (*start_frame)(AVFilterLink *, AVFilterBufferRef *); |
| 362 | AVFilterPad *dst = link->dstpad; | 363 | AVFilterPad *dst = link->dstpad; |
| 364 | int perms = picref->perms; | ||
| 363 | 365 | ||
| 364 | FF_DPRINTF_START(NULL, start_frame); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " "); ff_dprintf_ref(NULL, picref, 1); | 366 | FF_DPRINTF_START(NULL, start_frame); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " "); ff_dprintf_ref(NULL, picref, 1); |
| 365 | 367 | ||
| 366 | if (!(start_frame = dst->start_frame)) | 368 | if (!(start_frame = dst->start_frame)) |
| 367 | start_frame = avfilter_default_start_frame; | 369 | start_frame = avfilter_default_start_frame; |
| 368 | 370 | ||
| 371 | if (picref->linesize[0] < 0) | ||
| 372 | perms |= AV_PERM_NEG_LINESIZES; | ||
| 369 | /* prepare to copy the picture if it has insufficient permissions */ | 373 | /* prepare to copy the picture if it has insufficient permissions */ |
| 370 | if ((dst->min_perms & picref->perms) != dst->min_perms || | 374 | if ((dst->min_perms & perms) != dst->min_perms || dst->rej_perms & perms) { |
| 371 | dst->rej_perms & picref->perms) { | ||
| 372 | av_log(link->dst, AV_LOG_DEBUG, | 375 | av_log(link->dst, AV_LOG_DEBUG, |
| 373 | "frame copy needed (have perms %x, need %x, reject %x)\n", | 376 | "frame copy needed (have perms %x, need %x, reject %x)\n", |
| 374 | picref->perms, | 377 | picref->perms, |
| @@ -87,6 +87,7 @@ typedef struct AVFilterBuffer { · 86 unmodified lines | |||
| 87 | #define AV_PERM_PRESERVE 0x04 ///< nobody else can overwrite the buffer | 87 | #define AV_PERM_PRESERVE 0x04 ///< nobody else can overwrite the buffer |
| 88 | #define AV_PERM_REUSE 0x08 ///< can output the buffer multiple times, with the same contents each time | 88 | #define AV_PERM_REUSE 0x08 ///< can output the buffer multiple times, with the same contents each time |
| 89 | #define AV_PERM_REUSE2 0x10 ///< can output the buffer multiple times, modified each time | 89 | #define AV_PERM_REUSE2 0x10 ///< can output the buffer multiple times, modified each time |
| 90 | #define AV_PERM_NEG_LINESIZES 0x20 ///< the buffer requested can have negative linesizes | ||
| 90 | 91 | ||
| 91 | /** | 92 | /** |
| 92 | * Audio specific properties in a reference to an AVFilterBuffer. Since | 93 | * Audio specific properties in a reference to an AVFilterBuffer. Since |
| @@ -43,11 +43,13 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, · 42 unmodified lines | |||
| 43 | int w, int h) | 43 | int w, int h) |
| 44 | { | 44 | { |
| 45 | FlipContext *flip = link->dst->priv; | 45 | FlipContext *flip = link->dst->priv; |
| 46 | AVFilterBufferRef *picref; | ||
| 46 | int i; | 47 | int i; |
| 47 | 48 | ||
| 48 | AVFilterBufferRef *picref = avfilter_get_video_buffer(link->dst->outputs[0], | 49 | if (!(perms & AV_PERM_NEG_LINESIZES)) |
| 49 | perms, w, h); | 50 | return avfilter_default_get_video_buffer(link, perms, w, h); |
| 50 | 51 | ||
| 52 | picref = avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h); | ||
| 51 | for (i = 0; i < 4; i ++) { | 53 | for (i = 0; i < 4; i ++) { |
| 52 | int vsub = i == 1 || i == 2 ? flip->vsub : 0; | 54 | int vsub = i == 1 || i == 2 ? flip->vsub : 0; |
| 53 | 55 | ||