summaryrefslogtreecommitdiff
path: root/src/gen6_mfc_common.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix off-by-one in use of ROI regions in CQP modeMark Thompson2019-03-071-1/+1
| | | | Signed-off-by: Mark Thompson <sw@jkqxz.net>
* Remove dependency on EncROI attribute to enable encoding with ROIMark Thompson2019-03-071-1/+1
| | | | | | | The VAConfigAttribEncROI attribute is read-only, so a user should not need to write it to enable encoding with ROI. Signed-off-by: Mark Thompson <sw@jkqxz.net>
* Use f_code to determine max MV lengthMark Thompson2018-04-281-15/+3
| | | | | | | | | | | The motion vector length is constrained by the level but not set by it - we should instead use the f_code values to set the max MV length. This fixes encoding when the f_code values are not set to the highest allowed for the level, and also adds support for intermediate levels such as High 1440 which were not previously handled here. Signed-off-by: Mark Thompson <sw@jkqxz.net>
* AVC encoder: fix ROI CQP array indexingU. Artie Eoff2017-12-011-5/+5
| | | | | | Use correct variable for ROI indexing. Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
* AVC encoder: fix ROI config for CQPU. Artie Eoff2017-12-011-0/+2
| | | | | | | | | | | | | | | | | | | Introduced in: commit 972e6f2b36499389bc7cb7bb34414423b5525143 Author: Xiang, Haihao <haihao.xiang@intel.com> Date: Wed Jan 4 09:40:47 2017 +0800 AVC encoder: use generic ROI parameters num_roi setting was lost and thus always 0, which essentially disabled the "for (j = num_roi; j ; j--)" loop in the VA_RC_CQP case. Fix this by ensuring num_roi is set to the correct value stored in the common structure. Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
* Remove unused variableMark Thompson2017-10-101-1/+0
| | | | | | The last reference to it was removed in c408627e. Signed-off-by: Mark Thompson <sw@jkqxz.net>
* Don't create SEI unitXiang, Haihao2017-09-271-25/+0
| | | | | | | | Instead the application should provide a right packed SEI buffer if SEI is required because it is hard to know the value for each SEI element in the driver. Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
* Fix AUD insert issue in AVC encoder with GEN6/7.5/8.Jun Zhao2017-05-221-4/+52
| | | | | | | | | If find the AUD NAL in raw data list, it will insert AUD first in the bitstream. Fix #155 Signed-off-by: Jun Zhao <jun.zhao@intel.com>
* ENC: fix the low quality at the first GOP for AVC encoder on the platform ↵Pengfei Qu2017-05-111-4/+12
| | | | | | | | | | previous SKL RC logic initialize the big QP at the first GOP, this cause the low quality. Fixes #147 Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
* Make the compiler happyChih-Wei Huang2017-05-021-0/+1
| | | | | | | | | | To avoid the error: src/gen6_mfc_common.c:487:1: error: control may reach end of non-void function [-Werror,-Wreturn-type] } ^ Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
* Unify the coding style in the driverXiang, Haihao2017-04-071-137/+133
| | | | | | | | | | | | | | | Linux coding style is used in the driver source code. Use the command below to format/indent .c/.h files $> astyle --style=linux -cnpUH -s4 -M120 <file> A script of style_unify is added in the top-level directory to handle all .c/.h files in the driver. There is no change to any functionality This fixes https://github.com/01org/intel-vaapi-driver/issues/99 Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
* H.264 encoder: add a simple reactive VBR rate control modeMark Thompson2017-01-101-4/+122
| | | | | | | | | | | | | | | | | | | | | | | | This implements a simple reactive VBR rate control mode for single-layer H.264. The primary aim here is to avoid the problematic behaviour that the CBR rate controller displays on scene changes, where the QP can get pushed up by a large amount in a short period and compromise the quality of following frames to a very visible degree. The main idea, then, is to try to keep the HRD buffering above the target level most of the time, so that when a large frame is generated (on a scene change or when the stream complexity increases) we have plenty of slack to be able to encode the more difficult region without compromising quality immediately on the following frames. It is optimistic about the complexity of future frames, so even after generating one or more large frames on a significant change it will try to keep the QP at its current level until the HRD buffer bounds force a change to maintain the intended rate. Compared to the CBR rate controller, it keeps the quality level much more stable - QP does not always spike up as large frames are generated when the complexity of the stream increases transiently, but equally it does not reduce as quickly when the complexity of the stream decreases. Signed-off-by: Mark Thompson <sw@jkqxz.net>
* AVC encoder: use generic ROI parametersXiang, Haihao2017-01-051-40/+20
| | | | | | | Presently ROI parameters are stored in the common structure, each codec can use these parameters. Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
* H.264 encoder: respect initial QP settingMark Thompson2017-01-051-9/+15
| | | | | Signed-off-by: Mark Thompson <sw@jkqxz.net> Reviewed-by: Xiang, Haihao<haihao.xiang@intel.com>
* H.264 encoder: respect min QP settingMark Thompson2017-01-051-12/+16
| | | | | Signed-off-by: Mark Thompson <sw@jkqxz.net> Reviewed-by: Xiang, Haihao<haihao.xiang@intel.com>
* i965_encoder: consistently represent framerate as a fractionMark Thompson2016-12-231-4/+7
| | | | | | | Update references in both H.264 encoders (gen6_mfc and gen9_vdenc). Signed-off-by: Mark Thompson <sw@jkqxz.net> Reviewed-by: Xiang, Haihao<haihao.xiang@intel.com>
* svct: hrd check per layerXiang, Haihao2016-10-271-21/+26
| | | | | | | | | Hence we can use separate parameters to estimate QP per layer and get more accurate QP for next frame in the same layer. Tested-by: Wang, Fei W <fei.w.wang@intel.com> Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Sean V Kelley <seanvk@posteo.de>
* svct: Adjust the estimated frame size for QP=1Xiang, Haihao2016-10-241-2/+6
| | | | | Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Sean V Kelley <seanvk@posteo.de>
* svct: Save the frame numbers for each frame type in a GOP per layerXiang, Haihao2016-10-241-14/+23
| | | | | | | Use the right frame numbers in a GOP to estimate a QP for next frame Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Sean V Kelley <seanvk@posteo.de>
* svct: Save the current slice type per layerXiang, Haihao2016-10-241-0/+3
| | | | | | | | Use the right previous slice type to estimate a QP for next frame in the same layer Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Sean V Kelley <seanvk@posteo.de>
* svct: Save the current frame size per layerXiang, Haihao2016-10-241-0/+7
| | | | | | | | Use the the right previous frame size to estimate a QP for next frame in the same layer Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Sean V Kelley <seanvk@posteo.de>
* svct: Usa an array to store QP rounding accumulatorXiang, Haihao2016-10-241-5/+5
| | | | | | | We can do QP compensation per layer. Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Sean V Kelley <seanvk@posteo.de>
* Update CBR algo for H.264 per tempolar layerXiang, Haihao2016-09-161-26/+48
| | | | | | | | v2: rebased Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Luo, Focus <focus.luo@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* Initialize internal related parameters per temporal layer for H.264 BRCXiang, Haihao2016-09-161-28/+42
| | | | | | | | v2: rebased Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Luo, Focus <focus.luo@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* Use arrays to store BRC related parameters per temporal layerXiang, Haihao2016-09-161-33/+33
| | | | | | | | | | Currently only the first element is used v2: rebased Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Luo, Focus <focus.luo@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* Change the type of the 2nd parameter of intel_mfc_update_hrd()Xiang, Haihao2016-09-161-3/+5
| | | | | | | | | | In addition, change the two caller functions as well. v2: rebased Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Luo, Focus <focus.luo@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* Use arrays to store bitrate and framerateXiang, Haihao2016-09-161-3/+3
| | | | | | | | | | Currently only the first element is used v2: rebased Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Luo, Focus <focus.luo@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* Use a 2-dimensional array to store misc parametersXiang, Haihao2016-09-161-2/+2
| | | | | | | | | | | | | This patch allows multiple misc parameter buffers for the same type within the same Begin/Render/End sequence in the future. Currently only the first element for each misc type is used, so it doesn't change any functionality yet. v2: rebased Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Luo, Focus <focus.luo@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* move QpPrimeY to another inner structure for H.264/VP8 BRCXiang, Haihao2016-09-161-27/+31
| | | | | | | | | | It doesn't cause functionality change v2: rebased Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Luo, Focus <focus.luo@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* Remove unused fields and code in H.264/VP8 BRCXiang, Haihao2016-09-161-26/+3
| | | | | | | | | | H.264 and VP8 share some data structures v2: rebased Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Luo, Focus <focus.luo@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* Do not use the input parameters directly in H.264 BRCXiang, Haihao2016-09-161-33/+19
| | | | | | | | | | | The corresponding paramters are saved in the context v2: use frame_width_in_pixel and frame_height_in_pixel instead of frame_width_in_mbs and frame_height_in_mbs Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Luo, Focus <focus.luo@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* Remove unnecessary code in H.264 BRCXiang, Haihao2016-09-161-50/+2
| | | | | | | | v2: rebased Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Luo, Focus <focus.luo@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* intel_mfc_brc_prepare() only works for H.264 or H.264 MVCXiang, Haihao2016-09-161-1/+4
| | | | | | | | v2: rebased Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Luo, Focus <focus.luo@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* HEVC10bit ENC:enable hevc 10bit on VME and PAKPengfei Qu2016-09-081-0/+13
| | | | | | | | | 1.add p010->nv12 before VME 2.add CBR support Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com> Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com>
* Set cost to 0 for CHROMA INTRA modeXiang, Haihao2016-08-191-1/+1
| | | | | | | | | Commit 1cd6795 causes quality drop for U/V plane. Reported-by: Wang, Fei W <fei.w.wang@intel.com> Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Wang, Fei W <fei.w.wang@intel.com> Reviewed-by: Seaan V Kelley <seanvk@posteo.de>
* ROI:enable on gen8 and gen9Pengfei Qu2016-08-151-24/+32
| | | | | | | | | | | | | v2: use ASSERT_RET to check the ROI flag setted by user. instead of assert. v1: ROI enable on gen8 and gen9 Enable GPU to construct GPU command under ROI scenario fix roi attrib config incorrectly Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
* Encoding: ROI support for CQP/CBR on Haswell/IvyZhao Yakui2016-08-151-5/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | v2: remove unused variable set max ROI number to 3 according low power mode or 8 v1: merge 3 ROI patches together Encoding: Add the support of ROI under CQP on Haswell/Ivybridge Encoding: Add the support of ROI for CBR Currently it will allocate the different qp for the ROI and non_ROI region based on the ROI ratio. The qp delta is related with the ratio of ROI region. Encoding: Expand to support multiple ROI regions. Encoding: bits.roi_rc_qp_delat_support user guide: The first is that the driver should expose the feature of qp_delta in VAConfigAttribValEncROI. The second is that the user-app can pass the qp_delta flag in VAEncMiscParameterBufferROI and then the driver will use the qp_delta to calculate the corresponding qp for ROI region. For the non-ROI region: I think that currently we can use the following model to predicate the qp. (qp_value = intel_qpvalue_from_qp(qp)) Qp_value_roi * ROI_area + qp_value_nonroi * area_nonroi = base_qp * total_area. Signed-off-by: ceciliapeng <cecilia.peng@intel.com> Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
* encoding:use the qp per every macroblock on Ivy and haswellZhao Yakui2016-08-151-3/+15
| | | | | | | | | | v1: combine the patch together for Ivy and haswell use-CPU-to-construct-the-MFC-pak-command Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: ceciliapeng <cecilia.peng@intel.com> Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
* Encoding: Add one ROI flag and ROI bufferZhao Yakui2016-08-151-0/+69
| | | | | | | | | | | | | | | | v3: free the qp_per_mb for vme context v2: remove unused variable to avoid warning when compiling. v1: Add one flag to indicate whether ROI is supported in one encode context Allocate one ROI buffer to hold qp per mb dynamically Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: pjl <cecilia.peng@intel.com> Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
* Encoding: mbmv cost table related changes for ROIZhao Yakui2016-08-151-23/+137
| | | | | | | | | | | | | | | | | | | v3:remove the warning according to haihao's comments v2: merge three mbmv cost table related patches together. Encoding:Abstract the calculation of mbmv cost for qp as one function. Encoding:Add one function that initialize mbmv cost table for supported Qp range. Encoding:Setup one cost_table surface state for VME shader According haihao's comments, free pointer directly. v1: format/style aligment accordingly to avoid the warning. Currently the length of VME MEDIA_OBJECT command on Ivy can't exceed 8 dwords. If more parameter needs to be passed, the buffer length should be enlarged. Pass the Qp parameter into VME shader Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: pjl <cecilia.peng@intel.com> Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
* Set cost for modes used for VP8 encodingXiang, Haihao2016-08-041-0/+11
| | | | | | | | This is similar to what commit 1cd6795 does Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Tested-by: Wang, Fei W <fei.w.wang@intel.com> Reviewed-by: Sean V Kelley <seanvk@posteo.de>
* Encode: Set cost for MODE_CHROMA_INTRA/MODE_REFID_COSTXiang, Haihao2016-07-291-0/+5
| | | | | | | | | | | | | | | | | This fixes the remaining issues mentioned in https://bugs.freedesktop.org/show_bug.cgi?id=96703 after applying commit 3699c14 On GEN75+, driver copies vme_context->vme_state_message to VME kernel curbe buffer and VME kernel uses the data in curbe buffer to initialize VME message payload. vme_context->vme_state_message is set up in intel_vme_update_mbmv_cost(), which doesn't set all costs for used modes in VME kernels. The uninitialized mode cost will result in difference in VME output. Thanks for Elaine's finding that the issue disappears after initializing VME state message buffer with zeros. Signed-off-by: Elaine Wang <elaine.wang@intel.com> Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Sean V Kelley <seanvk@posteo.de> Tested-by: Mingruo Sun <mingruo.sun@intel.com>
* encode: h264, h265: Remove unnecessary warningSreerenj Balachandran2016-07-221-3/+0
| | | | | | | | | | | | The warning "Input ref list is Wrong" is generating based on assumption that reference frames provided in VAEncPictureParameterBuffer are in align with ref_pic_list included in VAEncSliceParameterBuffer. There shoudn't be such constraints, as per VA specification pic_param->reference_frames can have any order based on dpb manipulation. Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
* Make intel_avc_find_skipemulcnt() a public functionXiang, Haihao2016-05-091-52/+0
| | | | | | | In addition, move intel_avc_find_skipemulcnt() to i965_encoder_utils.c Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-By: Sean V Kelley <sean.v.kelley@intel.com>
* HEVC ENC:add CBR feature.Pengfei Qu2015-11-181-5/+23
| | | | | | Signed-off-by: Pengfei Qu <pengfei.qu@intel.com> [Haihao: Fix build warning] Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
* Fix klockwork critical message hit on calloc function usageLim Siew Hoon2015-09-061-0/+2
| | | | | | | | | | | The calloc function maybe return NULL, it will causing memory access violation if continue using NULL C structure. Add assert function to do checking on its. bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91699 Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
* VP8 HWEnc: Modify qp threshold value for mode cost calculatationZhong Li2015-06-121-1/+1
| | | | | | | The patch is helpful to improve quality when qp is lower than the threshold value. Signed-off-by: Zhong Li <zhong.li@intel.com>
* HEVC: Fix the Wrong slice type usageSreerenj Balachandran2015-06-021-2/+2
| | | | | | | | | | | Don't mix the slice_type values of h264 and h265. The SLICE_TYPE values of H264 and HEVC are different. H264: Bslice_type = 1, Pslice_type = 0 HEVC: Bslice_type = 0, Pslice_type = 1 Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* VP8 HWEnc: Fix CBR qp setting for vme costZhong Li2015-05-221-2/+9
| | | | | | | | | 1. The q_index range of vp8 is different from h264, it's need to be mapped to avc qp range. 2. For CBR case, qp should be set to CBR calculated value. Signed-off-by: Zhong Li <zhong.li@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* VP8 HWEnc: Add CBR SupportZhong Li2015-04-291-19/+0
| | | | | | | | Add bit rate control (CBR) for vp8 hw encoding v1->v2: follow haihao's comment to update this patch Signed-off-by: Zhong Li <zhong.li@intel.com>