Commit 86764b88 authored by Dafna Hirschfeld's avatar Dafna Hirschfeld Committed by Mauro Carvalho Chehab

media: vicodec: keep the ref frame according to the format in decoder

In the decoder, save the inner reference frame in the same
format as the capture buffer.
The decoder writes directly to the capture buffer and then
the capture buffer is copied to the reference buffer.
This will simplify the stateless decoder.
Signed-off-by: default avatarDafna Hirschfeld <dafna3@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent bdbfd992
...@@ -639,12 +639,13 @@ decide_blocktype(const u8 *cur, const u8 *reference, s16 *deltablock, ...@@ -639,12 +639,13 @@ decide_blocktype(const u8 *cur, const u8 *reference, s16 *deltablock,
return vari <= vard ? IBLOCK : PBLOCK; return vari <= vard ? IBLOCK : PBLOCK;
} }
static void fill_decoder_block(u8 *dst, const s16 *input, int stride) static void fill_decoder_block(u8 *dst, const s16 *input, int stride,
unsigned int dst_step)
{ {
int i, j; int i, j;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
for (j = 0; j < 8; j++, input++, dst++) { for (j = 0; j < 8; j++, input++, dst += dst_step) {
if (*input < 0) if (*input < 0)
*dst = 0; *dst = 0;
else if (*input > 255) else if (*input > 255)
...@@ -652,17 +653,19 @@ static void fill_decoder_block(u8 *dst, const s16 *input, int stride) ...@@ -652,17 +653,19 @@ static void fill_decoder_block(u8 *dst, const s16 *input, int stride)
else else
*dst = *input; *dst = *input;
} }
dst += stride - 8; dst += stride - (8 * dst_step);
} }
} }
static void add_deltas(s16 *deltas, const u8 *ref, int stride) static void add_deltas(s16 *deltas, const u8 *ref, int stride,
unsigned int ref_step)
{ {
int k, l; int k, l;
for (k = 0; k < 8; k++) { for (k = 0; k < 8; k++) {
for (l = 0; l < 8; l++) { for (l = 0; l < 8; l++) {
*deltas += *ref++; *deltas += *ref;
ref += ref_step;
/* /*
* Due to quantizing, it might possible that the * Due to quantizing, it might possible that the
* decoded coefficients are slightly out of range * decoded coefficients are slightly out of range
...@@ -673,7 +676,7 @@ static void add_deltas(s16 *deltas, const u8 *ref, int stride) ...@@ -673,7 +676,7 @@ static void add_deltas(s16 *deltas, const u8 *ref, int stride)
*deltas = 255; *deltas = 255;
deltas++; deltas++;
} }
ref += stride - 8; ref += stride - (8 * ref_step);
} }
} }
...@@ -718,8 +721,8 @@ static u32 encode_plane(u8 *input, u8 *refp, __be16 **rlco, __be16 *rlco_max, ...@@ -718,8 +721,8 @@ static u32 encode_plane(u8 *input, u8 *refp, __be16 **rlco, __be16 *rlco_max,
ifwht(cf->de_coeffs, cf->de_fwht, blocktype); ifwht(cf->de_coeffs, cf->de_fwht, blocktype);
if (blocktype == PBLOCK) if (blocktype == PBLOCK)
add_deltas(cf->de_fwht, refp, 8); add_deltas(cf->de_fwht, refp, 8, 1);
fill_decoder_block(refp, cf->de_fwht, 8); fill_decoder_block(refp, cf->de_fwht, 8, 1);
} }
input += 8 * input_step; input += 8 * input_step;
...@@ -828,8 +831,10 @@ u32 fwht_encode_frame(struct fwht_raw_frame *frm, ...@@ -828,8 +831,10 @@ u32 fwht_encode_frame(struct fwht_raw_frame *frm,
return encoding; return encoding;
} }
static bool decode_plane(struct fwht_cframe *cf, const __be16 **rlco, u8 *ref, static bool decode_plane(struct fwht_cframe *cf, const __be16 **rlco,
u32 height, u32 width, u32 coded_width, u32 height, u32 width, const u8 *ref, u32 ref_stride,
unsigned int ref_step, u8 *dst,
unsigned int dst_stride, unsigned int dst_step,
bool uncompressed, const __be16 *end_of_rlco_buf) bool uncompressed, const __be16 *end_of_rlco_buf)
{ {
unsigned int copies = 0; unsigned int copies = 0;
...@@ -841,10 +846,15 @@ static bool decode_plane(struct fwht_cframe *cf, const __be16 **rlco, u8 *ref, ...@@ -841,10 +846,15 @@ static bool decode_plane(struct fwht_cframe *cf, const __be16 **rlco, u8 *ref,
height = round_up(height, 8); height = round_up(height, 8);
if (uncompressed) { if (uncompressed) {
int i;
if (end_of_rlco_buf + 1 < *rlco + width * height / 2) if (end_of_rlco_buf + 1 < *rlco + width * height / 2)
return false; return false;
memcpy(ref, *rlco, width * height); for (i = 0; i < height; i++) {
*rlco += width * height / 2; memcpy(dst, *rlco, width);
dst += dst_stride;
*rlco += width / 2;
}
return true; return true;
} }
...@@ -856,15 +866,17 @@ static bool decode_plane(struct fwht_cframe *cf, const __be16 **rlco, u8 *ref, ...@@ -856,15 +866,17 @@ static bool decode_plane(struct fwht_cframe *cf, const __be16 **rlco, u8 *ref,
*/ */
for (j = 0; j < height / 8; j++) { for (j = 0; j < height / 8; j++) {
for (i = 0; i < width / 8; i++) { for (i = 0; i < width / 8; i++) {
u8 *refp = ref + j * 8 * coded_width + i * 8; const u8 *refp = ref + j * 8 * ref_stride +
i * 8 * ref_step;
u8 *dstp = dst + j * 8 * dst_stride + i * 8 * dst_step;
if (copies) { if (copies) {
memcpy(cf->de_fwht, copy, sizeof(copy)); memcpy(cf->de_fwht, copy, sizeof(copy));
if (stat & PFRAME_BIT) if (stat & PFRAME_BIT)
add_deltas(cf->de_fwht, refp, add_deltas(cf->de_fwht, refp,
coded_width); ref_stride, ref_step);
fill_decoder_block(refp, cf->de_fwht, fill_decoder_block(dstp, cf->de_fwht,
coded_width); dst_stride, dst_step);
copies--; copies--;
continue; continue;
} }
...@@ -884,23 +896,29 @@ static bool decode_plane(struct fwht_cframe *cf, const __be16 **rlco, u8 *ref, ...@@ -884,23 +896,29 @@ static bool decode_plane(struct fwht_cframe *cf, const __be16 **rlco, u8 *ref,
if (copies) if (copies)
memcpy(copy, cf->de_fwht, sizeof(copy)); memcpy(copy, cf->de_fwht, sizeof(copy));
if (stat & PFRAME_BIT) if (stat & PFRAME_BIT)
add_deltas(cf->de_fwht, refp, coded_width); add_deltas(cf->de_fwht, refp,
fill_decoder_block(refp, cf->de_fwht, coded_width); ref_stride, ref_step);
fill_decoder_block(dstp, cf->de_fwht, dst_stride,
dst_step);
} }
} }
return true; return true;
} }
bool fwht_decode_frame(struct fwht_cframe *cf, struct fwht_raw_frame *ref, bool fwht_decode_frame(struct fwht_cframe *cf, u32 hdr_flags,
u32 hdr_flags, unsigned int components_num, unsigned int components_num, unsigned int width,
unsigned int width, unsigned int height, unsigned int height, const struct fwht_raw_frame *ref,
unsigned int coded_width) unsigned int ref_stride, unsigned int ref_chroma_stride,
struct fwht_raw_frame *dst, unsigned int dst_stride,
unsigned int dst_chroma_stride)
{ {
const __be16 *rlco = cf->rlc_data; const __be16 *rlco = cf->rlc_data;
const __be16 *end_of_rlco_buf = cf->rlc_data + const __be16 *end_of_rlco_buf = cf->rlc_data +
(cf->size / sizeof(*rlco)) - 1; (cf->size / sizeof(*rlco)) - 1;
if (!decode_plane(cf, &rlco, ref->luma, height, width, coded_width, if (!decode_plane(cf, &rlco, height, width, ref->luma, ref_stride,
ref->luma_alpha_step, dst->luma, dst_stride,
dst->luma_alpha_step,
hdr_flags & FWHT_FL_LUMA_IS_UNCOMPRESSED, hdr_flags & FWHT_FL_LUMA_IS_UNCOMPRESSED,
end_of_rlco_buf)) end_of_rlco_buf))
return false; return false;
...@@ -908,27 +926,30 @@ bool fwht_decode_frame(struct fwht_cframe *cf, struct fwht_raw_frame *ref, ...@@ -908,27 +926,30 @@ bool fwht_decode_frame(struct fwht_cframe *cf, struct fwht_raw_frame *ref,
if (components_num >= 3) { if (components_num >= 3) {
u32 h = height; u32 h = height;
u32 w = width; u32 w = width;
u32 c = coded_width;
if (!(hdr_flags & FWHT_FL_CHROMA_FULL_HEIGHT)) if (!(hdr_flags & FWHT_FL_CHROMA_FULL_HEIGHT))
h /= 2; h /= 2;
if (!(hdr_flags & FWHT_FL_CHROMA_FULL_WIDTH)) { if (!(hdr_flags & FWHT_FL_CHROMA_FULL_WIDTH))
w /= 2; w /= 2;
c /= 2;
} if (!decode_plane(cf, &rlco, h, w, ref->cb, ref_chroma_stride,
if (!decode_plane(cf, &rlco, ref->cb, h, w, c, ref->chroma_step, dst->cb, dst_chroma_stride,
dst->chroma_step,
hdr_flags & FWHT_FL_CB_IS_UNCOMPRESSED, hdr_flags & FWHT_FL_CB_IS_UNCOMPRESSED,
end_of_rlco_buf)) end_of_rlco_buf))
return false; return false;
if (!decode_plane(cf, &rlco, ref->cr, h, w, c, if (!decode_plane(cf, &rlco, h, w, ref->cr, ref_chroma_stride,
ref->chroma_step, dst->cr, dst_chroma_stride,
dst->chroma_step,
hdr_flags & FWHT_FL_CR_IS_UNCOMPRESSED, hdr_flags & FWHT_FL_CR_IS_UNCOMPRESSED,
end_of_rlco_buf)) end_of_rlco_buf))
return false; return false;
} }
if (components_num == 4) if (components_num == 4)
if (!decode_plane(cf, &rlco, ref->alpha, height, width, if (!decode_plane(cf, &rlco, height, width, ref->alpha, ref_stride,
coded_width, ref->luma_alpha_step, dst->alpha, dst_stride,
dst->luma_alpha_step,
hdr_flags & FWHT_FL_ALPHA_IS_UNCOMPRESSED, hdr_flags & FWHT_FL_ALPHA_IS_UNCOMPRESSED,
end_of_rlco_buf)) end_of_rlco_buf))
return false; return false;
......
...@@ -141,9 +141,10 @@ u32 fwht_encode_frame(struct fwht_raw_frame *frm, ...@@ -141,9 +141,10 @@ u32 fwht_encode_frame(struct fwht_raw_frame *frm,
bool is_intra, bool next_is_intra, bool is_intra, bool next_is_intra,
unsigned int width, unsigned int height, unsigned int width, unsigned int height,
unsigned int stride, unsigned int chroma_stride); unsigned int stride, unsigned int chroma_stride);
bool fwht_decode_frame(struct fwht_cframe *cf, struct fwht_raw_frame *ref, bool fwht_decode_frame(struct fwht_cframe *cf, u32 hdr_flags,
u32 hdr_flags, unsigned int components_num, unsigned int components_num, unsigned int width,
unsigned int width, unsigned int height, unsigned int height, const struct fwht_raw_frame *ref,
unsigned int coded_width); unsigned int ref_stride, unsigned int ref_chroma_stride,
struct fwht_raw_frame *dst, unsigned int dst_stride,
unsigned int dst_chroma_stride);
#endif #endif
...@@ -248,14 +248,17 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) ...@@ -248,14 +248,17 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
{ {
unsigned int i, j, k;
u32 flags; u32 flags;
struct fwht_cframe cf; struct fwht_cframe cf;
u8 *p, *ref_p;
unsigned int components_num = 3; unsigned int components_num = 3;
unsigned int version; unsigned int version;
const struct v4l2_fwht_pixfmt_info *info; const struct v4l2_fwht_pixfmt_info *info;
unsigned int hdr_width_div, hdr_height_div; unsigned int hdr_width_div, hdr_height_div;
struct fwht_raw_frame dst_rf;
unsigned int dst_chroma_stride = state->stride;
unsigned int ref_chroma_stride = state->ref_stride;
unsigned int dst_size = state->stride * state->coded_height;
unsigned int ref_size;
if (!state->info) if (!state->info)
return -EINVAL; return -EINVAL;
...@@ -303,241 +306,29 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) ...@@ -303,241 +306,29 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
hdr_height_div != info->height_div) hdr_height_div != info->height_div)
return -EINVAL; return -EINVAL;
if (!fwht_decode_frame(&cf, &state->ref_frame, flags, components_num, if (prepare_raw_frame(&dst_rf, info, p_out, dst_size))
state->visible_width, state->visible_height,
state->coded_width))
return -EINVAL; return -EINVAL;
if (info->planes_num == 3) {
/* dst_chroma_stride /= 2;
* TODO - handle the case where the compressed stream encodes a ref_chroma_stride /= 2;
* different format than the requested decoded format.
*/
switch (state->info->id) {
case V4L2_PIX_FMT_GREY:
ref_p = state->ref_frame.luma;
for (i = 0; i < state->coded_height; i++) {
memcpy(p_out, ref_p, state->visible_width);
p_out += state->stride;
ref_p += state->coded_width;
} }
break; if (info->id == V4L2_PIX_FMT_NV24 ||
case V4L2_PIX_FMT_YUV420: info->id == V4L2_PIX_FMT_NV42) {
case V4L2_PIX_FMT_YUV422P: dst_chroma_stride *= 2;
ref_p = state->ref_frame.luma; ref_chroma_stride *= 2;
for (i = 0; i < state->coded_height; i++) {
memcpy(p_out, ref_p, state->visible_width);
p_out += state->stride;
ref_p += state->coded_width;
} }
ref_p = state->ref_frame.cb;
for (i = 0; i < state->coded_height / 2; i++) {
memcpy(p_out, ref_p, state->visible_width / 2);
p_out += state->stride / 2;
ref_p += state->coded_width / 2;
}
ref_p = state->ref_frame.cr;
for (i = 0; i < state->coded_height / 2; i++) {
memcpy(p_out, ref_p, state->visible_width / 2);
p_out += state->stride / 2;
ref_p += state->coded_width / 2;
}
break;
case V4L2_PIX_FMT_YVU420:
ref_p = state->ref_frame.luma;
for (i = 0; i < state->coded_height; i++) {
memcpy(p_out, ref_p, state->visible_width);
p_out += state->stride;
ref_p += state->coded_width;
}
ref_p = state->ref_frame.cr; ref_size = state->ref_stride * state->coded_height;
for (i = 0; i < state->coded_height / 2; i++) {
memcpy(p_out, ref_p, state->visible_width / 2);
p_out += state->stride / 2;
ref_p += state->coded_width / 2;
}
ref_p = state->ref_frame.cb;
for (i = 0; i < state->coded_height / 2; i++) {
memcpy(p_out, ref_p, state->visible_width / 2);
p_out += state->stride / 2;
ref_p += state->coded_width / 2;
}
break;
case V4L2_PIX_FMT_NV12:
case V4L2_PIX_FMT_NV16:
case V4L2_PIX_FMT_NV24:
ref_p = state->ref_frame.luma;
for (i = 0; i < state->coded_height; i++) {
memcpy(p_out, ref_p, state->visible_width);
p_out += state->stride;
ref_p += state->coded_width;
}
k = 0; if (prepare_raw_frame(&state->ref_frame, info, state->ref_frame.buf,
for (i = 0; i < state->coded_height / 2; i++) { ref_size))
for (j = 0, p = p_out; j < state->coded_width / 2; j++) { return -EINVAL;
*p++ = state->ref_frame.cb[k];
*p++ = state->ref_frame.cr[k];
k++;
}
p_out += state->stride;
}
break;
case V4L2_PIX_FMT_NV21:
case V4L2_PIX_FMT_NV61:
case V4L2_PIX_FMT_NV42:
ref_p = state->ref_frame.luma;
for (i = 0; i < state->coded_height; i++) {
memcpy(p_out, ref_p, state->visible_width);
p_out += state->stride;
ref_p += state->coded_width;
}
k = 0; if (!fwht_decode_frame(&cf, flags, components_num,
for (i = 0; i < state->coded_height / 2; i++) { state->visible_width, state->visible_height,
for (j = 0, p = p_out; j < state->coded_width / 2; j++) { &state->ref_frame, state->ref_stride, ref_chroma_stride,
*p++ = state->ref_frame.cr[k]; &dst_rf, state->stride, dst_chroma_stride))
*p++ = state->ref_frame.cb[k];
k++;
}
p_out += state->stride;
}
break;
case V4L2_PIX_FMT_YUYV:
k = 0;
for (i = 0; i < state->coded_height; i++) {
for (j = 0, p = p_out; j < state->coded_width / 2; j++) {
*p++ = state->ref_frame.luma[k];
*p++ = state->ref_frame.cb[k / 2];
*p++ = state->ref_frame.luma[k + 1];
*p++ = state->ref_frame.cr[k / 2];
k += 2;
}
p_out += state->stride;
}
break;
case V4L2_PIX_FMT_YVYU:
k = 0;
for (i = 0; i < state->coded_height; i++) {
for (j = 0, p = p_out; j < state->coded_width / 2; j++) {
*p++ = state->ref_frame.luma[k];
*p++ = state->ref_frame.cr[k / 2];
*p++ = state->ref_frame.luma[k + 1];
*p++ = state->ref_frame.cb[k / 2];
k += 2;
}
p_out += state->stride;
}
break;
case V4L2_PIX_FMT_UYVY:
k = 0;
for (i = 0; i < state->coded_height; i++) {
for (j = 0, p = p_out; j < state->coded_width / 2; j++) {
*p++ = state->ref_frame.cb[k / 2];
*p++ = state->ref_frame.luma[k];
*p++ = state->ref_frame.cr[k / 2];
*p++ = state->ref_frame.luma[k + 1];
k += 2;
}
p_out += state->stride;
}
break;
case V4L2_PIX_FMT_VYUY:
k = 0;
for (i = 0; i < state->coded_height; i++) {
for (j = 0, p = p_out; j < state->coded_width / 2; j++) {
*p++ = state->ref_frame.cr[k / 2];
*p++ = state->ref_frame.luma[k];
*p++ = state->ref_frame.cb[k / 2];
*p++ = state->ref_frame.luma[k + 1];
k += 2;
}
p_out += state->stride;
}
break;
case V4L2_PIX_FMT_RGB24:
case V4L2_PIX_FMT_HSV24:
k = 0;
for (i = 0; i < state->coded_height; i++) {
for (j = 0, p = p_out; j < state->coded_width; j++) {
*p++ = state->ref_frame.cr[k];
*p++ = state->ref_frame.luma[k];
*p++ = state->ref_frame.cb[k];
k++;
}
p_out += state->stride;
}
break;
case V4L2_PIX_FMT_BGR24:
k = 0;
for (i = 0; i < state->coded_height; i++) {
for (j = 0, p = p_out; j < state->coded_width; j++) {
*p++ = state->ref_frame.cb[k];
*p++ = state->ref_frame.luma[k];
*p++ = state->ref_frame.cr[k];
k++;
}
p_out += state->stride;
}
break;
case V4L2_PIX_FMT_RGB32:
case V4L2_PIX_FMT_XRGB32:
case V4L2_PIX_FMT_HSV32:
k = 0;
for (i = 0; i < state->coded_height; i++) {
for (j = 0, p = p_out; j < state->coded_width; j++) {
*p++ = 0;
*p++ = state->ref_frame.cr[k];
*p++ = state->ref_frame.luma[k];
*p++ = state->ref_frame.cb[k];
k++;
}
p_out += state->stride;
}
break;
case V4L2_PIX_FMT_BGR32:
case V4L2_PIX_FMT_XBGR32:
k = 0;
for (i = 0; i < state->coded_height; i++) {
for (j = 0, p = p_out; j < state->coded_width; j++) {
*p++ = state->ref_frame.cb[k];
*p++ = state->ref_frame.luma[k];
*p++ = state->ref_frame.cr[k];
*p++ = 0;
k++;
}
p_out += state->stride;
}
break;
case V4L2_PIX_FMT_ARGB32:
k = 0;
for (i = 0; i < state->coded_height; i++) {
for (j = 0, p = p_out; j < state->coded_width; j++) {
*p++ = state->ref_frame.alpha[k];
*p++ = state->ref_frame.cr[k];
*p++ = state->ref_frame.luma[k];
*p++ = state->ref_frame.cb[k];
k++;
}
p_out += state->stride;
}
break;
case V4L2_PIX_FMT_ABGR32:
k = 0;
for (i = 0; i < state->coded_height; i++) {
for (j = 0, p = p_out; j < state->coded_width; j++) {
*p++ = state->ref_frame.cb[k];
*p++ = state->ref_frame.luma[k];
*p++ = state->ref_frame.cr[k];
*p++ = state->ref_frame.alpha[k];
k++;
}
p_out += state->stride;
}
break;
default:
return -EINVAL; return -EINVAL;
}
return 0; return 0;
} }
...@@ -30,6 +30,7 @@ struct v4l2_fwht_state { ...@@ -30,6 +30,7 @@ struct v4l2_fwht_state {
unsigned int coded_width; unsigned int coded_width;
unsigned int coded_height; unsigned int coded_height;
unsigned int stride; unsigned int stride;
unsigned int ref_stride;
unsigned int gop_size; unsigned int gop_size;
unsigned int gop_cnt; unsigned int gop_cnt;
u16 i_frame_qp; u16 i_frame_qp;
......
...@@ -153,6 +153,43 @@ static struct vicodec_q_data *get_q_data(struct vicodec_ctx *ctx, ...@@ -153,6 +153,43 @@ static struct vicodec_q_data *get_q_data(struct vicodec_ctx *ctx,
return NULL; return NULL;
} }
static void copy_cap_to_ref(const u8 *cap, const struct v4l2_fwht_pixfmt_info *info,
struct v4l2_fwht_state *state)
{
int plane_idx;
u8 *p_ref = state->ref_frame.buf;
unsigned int cap_stride = state->stride;
unsigned int ref_stride = state->ref_stride;
for (plane_idx = 0; plane_idx < info->planes_num; plane_idx++) {
int i;
unsigned int h_div = (plane_idx == 1 || plane_idx == 2) ?
info->height_div : 1;
const u8 *row_cap = cap;
u8 *row_ref = p_ref;
if (info->planes_num == 3 && plane_idx == 1) {
cap_stride /= 2;
ref_stride /= 2;
}
if (plane_idx == 1 &&
(info->id == V4L2_PIX_FMT_NV24 ||
info->id == V4L2_PIX_FMT_NV42)) {
cap_stride *= 2;
ref_stride *= 2;
}
for (i = 0; i < state->visible_height / h_div; i++) {
memcpy(row_ref, row_cap, ref_stride);
row_ref += ref_stride;
row_cap += cap_stride;
}
cap += cap_stride * (state->coded_height / h_div);
p_ref += ref_stride * (state->coded_height / h_div);
}
}
static int device_process(struct vicodec_ctx *ctx, static int device_process(struct vicodec_ctx *ctx,
struct vb2_v4l2_buffer *src_vb, struct vb2_v4l2_buffer *src_vb,
struct vb2_v4l2_buffer *dst_vb) struct vb2_v4l2_buffer *dst_vb)
...@@ -194,6 +231,8 @@ static int device_process(struct vicodec_ctx *ctx, ...@@ -194,6 +231,8 @@ static int device_process(struct vicodec_ctx *ctx,
ret = v4l2_fwht_decode(state, p_src, p_dst); ret = v4l2_fwht_decode(state, p_src, p_dst);
if (ret < 0) if (ret < 0)
return ret; return ret;
copy_cap_to_ref(p_dst, ctx->state.info, &ctx->state);
vb2_set_plane_payload(&dst_vb->vb2_buf, 0, q_dst->sizeimage); vb2_set_plane_payload(&dst_vb->vb2_buf, 0, q_dst->sizeimage);
} }
return 0; return 0;
...@@ -1366,6 +1405,7 @@ static int vicodec_start_streaming(struct vb2_queue *q, ...@@ -1366,6 +1405,7 @@ static int vicodec_start_streaming(struct vb2_queue *q,
state->stride = q_data->coded_width * state->stride = q_data->coded_width *
info->bytesperline_mult; info->bytesperline_mult;
state->ref_stride = q_data->coded_width * info->luma_alpha_step;
state->ref_frame.buf = kvmalloc(total_planes_size, GFP_KERNEL); state->ref_frame.buf = kvmalloc(total_planes_size, GFP_KERNEL);
state->ref_frame.luma = state->ref_frame.buf; state->ref_frame.luma = state->ref_frame.buf;
ctx->comp_max_size = total_planes_size; ctx->comp_max_size = total_planes_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment