On Thu, Jun 28, 2018 at 12:28 AM Stanimir Varbanov <stanimir.varbanov@xxxxxxxxxx> wrote: > > This move the calculations of raw and compressed buffer sizes > on common helper and make it identical for encoder and decoder. > > Signed-off-by: Stanimir Varbanov <stanimir.varbanov@xxxxxxxxxx> > --- > drivers/media/platform/qcom/venus/helpers.c | 98 +++++++++++++++++++++++++++++ > drivers/media/platform/qcom/venus/helpers.h | 2 + > drivers/media/platform/qcom/venus/vdec.c | 54 ++++------------ > drivers/media/platform/qcom/venus/venc.c | 56 ++++------------- > 4 files changed, 126 insertions(+), 84 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c > index 6b31c91528ed..a342472ae2f0 100644 > --- a/drivers/media/platform/qcom/venus/helpers.c > +++ b/drivers/media/platform/qcom/venus/helpers.c > @@ -452,6 +452,104 @@ int venus_helper_get_bufreq(struct venus_inst *inst, u32 type, > } > EXPORT_SYMBOL_GPL(venus_helper_get_bufreq); > > +static u32 get_framesize_raw_nv12(u32 width, u32 height) > +{ > + u32 y_stride, uv_stride, y_plane; > + u32 y_sclines, uv_sclines, uv_plane; > + u32 size; > + > + y_stride = ALIGN(width, 128); > + uv_stride = ALIGN(width, 128); > + y_sclines = ALIGN(height, 32); > + uv_sclines = ALIGN(((height + 1) >> 1), 16); > + > + y_plane = y_stride * y_sclines; > + uv_plane = uv_stride * uv_sclines + SZ_4K; > + size = y_plane + uv_plane + SZ_8K; Do you know the reason for this extra 8K at the end?