aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-09 02:42:47 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-09 02:42:47 +0200
commit5c8809b45b789bd664cdecfc9f40b8dce39c2a13 (patch)
tree190964b747a0be59f5afaedce7f45d8d495ed9d5
parent82a6e18bbb6e7f4e2919a09eef4b9f2935e81b32 (diff)
downloadffmpeg-5c8809b45b789bd664cdecfc9f40b8dce39c2a13.tar.gz
avcodec/error_resilience: support grayscale
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/error_resilience.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index ced0ceb36c..df4a64d17a 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -84,6 +84,8 @@ static void put_dc(ERContext *s, uint8_t *dest_y, uint8_t *dest_cb,
dcv = 0;
else if (dcv > 2040)
dcv = 2040;
+
+ if (dest_cr)
for (y = 0; y < 8; y++) {
int x;
for (x = 0; x < 8; x++) {
@@ -1228,6 +1230,9 @@ void ff_er_frame_end(ERContext *s)
dc_ptr[(n & 1) + (n >> 1) * s->b8_stride] = (dc + 4) >> 3;
}
+ if (!s->cur_pic.f->data[2])
+ continue;
+
dcu = dcv = 0;
for (y = 0; y < 8; y++) {
int x;
@@ -1268,6 +1273,8 @@ void ff_er_frame_end(ERContext *s)
dest_y = s->cur_pic.f->data[0] + mb_x * 16 + mb_y * 16 * linesize[0];
dest_cb = s->cur_pic.f->data[1] + mb_x * 8 + mb_y * 8 * linesize[1];
dest_cr = s->cur_pic.f->data[2] + mb_x * 8 + mb_y * 8 * linesize[2];
+ if (!s->cur_pic.f->data[2])
+ dest_cb = dest_cr = NULL;
put_dc(s, dest_y, dest_cb, dest_cr, mb_x, mb_y);
}
@@ -1278,18 +1285,21 @@ void ff_er_frame_end(ERContext *s)
/* filter horizontal block boundaries */
h_block_filter(s, s->cur_pic.f->data[0], s->mb_width * 2,
s->mb_height * 2, linesize[0], 1);
- h_block_filter(s, s->cur_pic.f->data[1], s->mb_width,
- s->mb_height, linesize[1], 0);
- h_block_filter(s, s->cur_pic.f->data[2], s->mb_width,
- s->mb_height, linesize[2], 0);
/* filter vertical block boundaries */
v_block_filter(s, s->cur_pic.f->data[0], s->mb_width * 2,
s->mb_height * 2, linesize[0], 1);
- v_block_filter(s, s->cur_pic.f->data[1], s->mb_width,
- s->mb_height, linesize[1], 0);
- v_block_filter(s, s->cur_pic.f->data[2], s->mb_width,
- s->mb_height, linesize[2], 0);
+
+ if (s->cur_pic.f->data[2]) {
+ h_block_filter(s, s->cur_pic.f->data[1], s->mb_width,
+ s->mb_height, linesize[1], 0);
+ h_block_filter(s, s->cur_pic.f->data[2], s->mb_width,
+ s->mb_height, linesize[2], 0);
+ v_block_filter(s, s->cur_pic.f->data[1], s->mb_width,
+ s->mb_height, linesize[1], 0);
+ v_block_filter(s, s->cur_pic.f->data[2], s->mb_width,
+ s->mb_height, linesize[2], 0);
+ }
}
ec_clean: