summaryrefslogtreecommitdiff
path: root/src/gen75_mfd.c
Commit message (Collapse)AuthorAgeFilesLines
* genX_mfd: fix out-of-bounds reference pixel replicationcarpalis2018-05-311-11/+6
| | | | | | | | Out-of-bounds reference pixel replication should take into account the frame coding mode of the reference frame(s), not the frame coding mode of the current frame. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: ignore FASTUVMC for interlace frame P and B picturescarpalis2018-04-201-6/+11
| | | | | | | | | Interlace frame P and B pictures should ignore the FASTUVMC syntax element, as stated in section 10.7.3.7 of VC-1 spec. Furthermore, prevent using the MVMODE syntax element for interlace frame P and B pictures, as these picture types do not include MVMODE or MVMODE2. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* Fix typo of variable name in JPEG decodingXiang, Haihao2018-03-141-1/+1
| | | | | | h2 is typo of h1 Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
* VC1: Fix for frame coding modeXiang, Haihao2018-01-091-3/+5
| | | | | | | | | Some VC1 clips might be marked interlaced but have fcm < 2, and the wrong fcm will lead to undefined behavior, such as GPU hang. This fixes https://github.com/01org/intel-vaapi-driver/issues/316 Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
* genX_mfd: add comment on dmv buffer scalingcarpalis2018-01-051-0/+6
| | | | Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: optimize comparison out of loopcarpalis2018-01-051-8/+10
| | | | Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: clean up the use of profile bitstream elementcarpalis2018-01-051-16/+6
| | | | | | | | | | Only gen6 needs mapping from input range to the hardware range for the profile bitstream element. For gen7 and up there is no need for a mapping as the hardware uses only one bit indicating simple/main profile or advanced profile. Therefore, we can remove the mapping for gen7 and clean up the code a bit. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: fix range reduction scalingcarpalis2018-01-051-16/+52
| | | | Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: fix dmv buffer size calculationcarpalis2018-01-051-2/+2
| | | | | | | | | The picture size may vary within a VC-1 stream. We should calculate the dmv buffer size from the size of the surface instead of the size of the first picture that uses the surface. Subsequent pictures may be larger, which could overflow the dmv buffer. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: fix intensity compensation for frame-interlaced contentcarpalis2018-01-051-2/+2
| | | | | | | | When frame-interlaced pictures are signalled to be intensity compensated, we need to set the hardware to compensating both the top and the bottom field. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* gen75_mfd: add support for VC-1 interlaced intensity compensationcarpalis2018-01-051-41/+241
| | | | Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* gen75_mfd: add support for VC-1 interlaced reference framescarpalis2018-01-051-38/+117
| | | | Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* gen75_mfd: add support for VC-1 interlaced picturescarpalis2018-01-051-23/+114
| | | | Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: fix calculation of motion vector modecarpalis2018-01-051-6/+2
| | | | | | | | | As stated in the PRM, the FastUVMCFlag field should be equal to the LSB of the Motion Vector Mode field. This also conforms to VC-1 spec, as FASTUVMC controls whether color difference motion vectors are reconstructed with quarter of half pixel resolution. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: no raw coded bitplanes for skipped picturescarpalis2018-01-051-7/+16
| | | | | | | Skipped pictures should not signal raw coded bitplanes as there are no MBs encoded. Failure to do so results in decoding errors. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: fix BitplanePresentFlag for skipped picturescarpalis2018-01-051-3/+6
| | | | | | | | | Skipped pictures do not pass a bitplane buffer. We do, however, locally encode a bitplane buffer with only the SKIPMB bit set. The presence of this buffer must be passed through the BitplanePresentFlag hardware field. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: align dmv buffer use with VC-1 spec and PRMcarpalis2018-01-051-17/+28
| | | | | | | | As stated in VC-1 spec, the direct MV buffer will be written when decoding a P frame. Subsequently, the direct MV buffer is read when decoding a B frame that backward references this P frame. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: no need for loop filtering for skipped picturescarpalis2018-01-051-4/+13
| | | | | | | | | Skipped pictures are equal to their reference frame and, therefore, should not pass the loop filter. Although the loop filter was already a null operation as all transform coefficients are zero for skipped pictures, this may save some cyles in the decoder hardware. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: remove mapping of I frame to BI framecarpalis2018-01-051-4/+0
| | | | | | | | | This mapping does not make sense. Unless the mapping is some workaround for a hardware quirk, we should be able to safely remove it. If this breaks things, we can always put it back accompanied with an explanation in the code. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: change order within if-elsecarpalis2018-01-051-6/+6
| | | | Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: use input range instead of mapped range in comparisoncarpalis2018-01-051-2/+2
| | | | Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: remove one-to-one mapping for picture_typecarpalis2018-01-051-17/+15
| | | | | | | | | | | In genX_mfd_vc1_pic_state, the logic of picture_type is not very clear as it is mapped from the input range to the hardware range. The mapping, however, is an identity mapping that, effectively, only maps a skipped picture to a P picture. By putting the skipped picture logic explicitly in the ocde, we can remove the unnecessary mapping and make the logic much more clear. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: fix unnecessary variable reusecarpalis2018-01-051-5/+2
| | | | Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: do not scale dmv buffer with heightcarpalis2018-01-051-2/+1
| | | | | | | | PRM states that for VC-1 the direct motion vector buffer may be scaled with frame height but should not be scaled with frame width. Hardware assumes frame width is fixed at 128 MBs. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: align hardware programming of Y Offset for V(Cr) with commentcarpalis2018-01-051-1/+1
| | | | | | | | Although the PRM does not state that this field must be zero for non-JPEG, we might as well set it to zero as indicated in the comment and to make its use more clear. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: fix hardware programming for bitplanes coded in raw modecarpalis2018-01-051-7/+7
| | | | | | | | | | | Bitplanes that are coded in raw mode are signalled through the raw_coding flags in the VAPictureParameterBufferVC1 structure. The absence of a bitplane does not necessarily imply that this bit is encoded in raw mode. A progressive P picture in advanced profile, for example, does not encode the SKIPMB bitplane nor does it encode this bit in raw mode. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: mask unused bits in bitplane_present.valuecarpalis2018-01-051-2/+2
| | | | | | | | | Due to the union construct, unused bits in bitplane_present.value might be uninitialized even when the used bits are all set to a value. Masking the unused bits prevents spurious true values when all used bits are unset, e.g. skipped pictures. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: fix bitplane encoding for skipped picturescarpalis2018-01-051-20/+36
| | | | | | | | | VC-1 skipped pictures do not encode a slice or MB layer, nor do they encode any bitplanes. For a skipped picture, we should unconditionally encode the bitplane buffer with only the SKIPMB bit set. Furthermore, we optimize the static picture_type comparison out of the double loop. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* gen75_mfd: Check ptr before dereferencingcarpalis2018-01-051-4/+5
| | | | Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* genX_mfd: remove emulation byte on MB layer boundarycarpalis2018-01-051-2/+7
| | | | | | | | | | As stated in the PRM, VC-1 decoder hardware cannot handle the case where the second 0x00 byte in the emulation prevention pattern 0x00 0x00 0x03 (0x00-0x03) coincides with the start of the MB layer. Fixed by overwriting the 0x03 byte with the previous 0x00 byte and adjusting the MB layer byte offset accordingly. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* implement intensity compensation for VC-1 decodingcarpalis2017-07-281-6/+38
| | | Intensity compensation was not present for B-frames, but only for P-frames. When a P-frame flags intensity compensation for its forward reference frame, all subsequent B-frames that use this reference frame as well, need to do intensity compensation as well.
* correct subsampling calculate methods of various fourcc that jpeg support.Wang, Tiantian2017-06-121-24/+16
| | | | | | This fixes https://github.com/01org/intel-vaapi-driver/issues/10 Signed-off-by: Wang Tiantian <tiantian.wang@intel.com>
* Unify the coding style in the driverXiang, Haihao2017-04-071-291/+291
| | | | | | | | | | | | | | | 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>
* Clean up the duplicate extra two line of codeLim Siew Hoon2015-09-061-3/+0
| | | | Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
* Fix if statement checking sampling factor for YUV422V_4YLim Siew Hoon2015-09-061-1/+1
| | | | Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
* Fix klockwork critical message hit on calloc function usageLim Siew Hoon2015-09-061-0/+3
| | | | | | | | | | | 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>
* H264: Use macroblock pair to calculate H264 decoding parameter under MBAFF flagZhao Yakui2015-07-061-2/+8
| | | | | | | | | | | Based on the H264 spec the macroblock pair should be used to calculate the corresponding parameters under MBAFF.(mb-adaptive frame-field). Otherwise the wrong parameter is sent to GPU HW. Fix the GPU hang issue in https://bugs.freedesktop.org/show_bug.cgi?id=91207 Tested-by: Lim, Siew Hoon <siew.hoon.lim@intel.com> Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
* Decode: Free the allocated internal surface used by JPEG to avoid memory leakZhao Yakui2015-05-181-0/+12
| | | | | | Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Sean V Kelley <seanvk@posteo.de> Tested-by: Sean V Kelley <seanvk@posteo.de>
* VC1: No overlap smoothing if the overlap flag is 0Xiang, Haihao2015-02-031-19/+23
| | | | | Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
* decoder: Add struct gen_codec_surfaceXiang, Haihao2014-12-141-1/+1
| | | | | | | | | | | | It is the base of struct gen_avc_surface, and move frame_store_id from gen_avc_surface to gen_codec_surface Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> (cherry picked from commit fc7085d4930f0ceef8ced414af96a7c18cf4fe52) Conflicts: src/i965_decoder_utils.c
* Add phantom slice support on IVB+Zhong Li2014-09-051-0/+12
| | | | | | | | | | | | | | HW requires driver to add a phantom slice when FirstMbX and FirstMbY are not 0, in order to avc decoding error concealment. Otherwise, GPU may hang. This patch is a workround for bug: https://bugs.freedesktop.org/show_bug.cgi?id=81447 v1->v2: Follow haihao's suggestion to use common funcion of gen6 phantom slice. v2->v3: Remove an extraneous newline. Signed-off-by: Zhong Li <zhong.li@intel.com> Reviewed-by: Xiang Haihao <haihao.xiang@intel.com> Gwenole Beauchesne <gwenole.beauchesne@intel.com> (cherry picked from commit 9672c5ab17c32f25ce1bbdb883abda689440b116)
* decoder: h264: fix frame store logic for MVC.Gwenole Beauchesne2014-06-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In strict MVC decoding mode, when only the necessary set of inter-view reference pictures are passed to the ReferenceFrames array for decoding the current picture, we should not re-use a frame store id that might be needed for decoding another view component in the same access unit. One way to solve this problem is to track when the VA surface in a specified frame store id was last referenced. So, a "ref_age" field is introduced to the GenFrameStore struct and is updated whenever the surface is being referenced. Additionally, the list of retired refs candidates (free_refs) is kept ordered by increasing ref_age. That way, we can immediately know what is the oldest frame store id to recycle. Let deltaAge = CurrAge - RefAge: If deltaAge > 1, we know for sure that the VA surface is gone ; If deltaAge = 1, the surface could be re-used for inter prediction ; If deltaAge = 0, the surface could be re-used for inter-view prediction. The ref_age in each Frame Store entry is always current, i.e. it is the same for all reference frames that intervened in the decoding process of all inter view components of the previous access unit. The age tracks access units. v2: used a more correct representation of age, instead of POC [Yakui] v3: minor optimization for detecting changes of access unit [Haihao] Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com> (cherry picked from commit 3b5eb0522fbfe1220dcd0c0bb093a93cfc25e22c)
* surface: drop SURFACE_DISPLAYED flag.Gwenole Beauchesne2014-06-161-2/+4
| | | | | | | | | | The optimization by which the VA surface storage is deallocated after it is displayed and not used for reference or vaDeriveImage() purposes cannot be implemented safely. We need to honour explicit lifetimes defined by the upper codec layer. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com> (cherry picked from commit 84926ace7a2c5b88df1ada167a1c273128469aad)
* decoder: h264: expose the set of supported MVC profiles.Gwenole Beauchesne2014-06-161-0/+4
| | | | | | | | | | | | | | H.264 MVC decoding support is defined as follows: - Stereo High profile on Sandybridge and newer ; - Multiview High profile on Haswell and newer. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com> (cherry picked from commit 1f244834dedb7b46863b315a898d8649d01c5f58) Conflicts: src/i965_device_info.c src/i965_drv_video.c src/va_backend_compat.h
* decoder: h264: enable Picture ID Remapping on Haswell and newer.Gwenole Beauchesne2014-06-161-17/+6
| | | | | | | | | | | | | Fill and submit MFX_AVC_PICID_STATE commands to Gen7.5+ hardware. This optimizes the management of the DPB as the binding array can now contain entries in any order. This also makes it possible to support H.264 MultiView High profiles, with any particular number of views. v2: added more comments for clarity, removed an assert [Yakui] Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com> (cherry picked from commit 8dfdf10612c726b60ecd5b61eee2b7d6a520bb33)
* decoder: h264: factor out look ups for VA/H264 picture info.Gwenole Beauchesne2014-06-161-38/+14
| | | | | | | | Add new avc_find_picture() helper function to search for a VAPictureH264 struct based on the supplied VA surface id. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com> (cherry picked from commit 3f4f9fc2893af24b7e88f44b6350a5a74d49f0c2)
* Define i965_CreateSurfaces in header file explicitly to avoid multiple ↵Zhao Yakui2014-06-161-8/+0
| | | | | | | declaration Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> (cherry picked from commit 8b3945aa5df443e93a3f5e6e97dffb1574e2a936)
* decoder: h264: optimize support for grayscale surfaces.Gwenole Beauchesne2014-06-021-1/+5
| | | | | | | | | | | | | Optimize support for grayscale surfaces in two aspects: (i) space by only allocating the luminance component ; (ii) speed by avoiding initialization of the (now inexistent) chrominance planes. Keep backward compatibility with older codec layers that only supported YUV 4:2:0 and not grayscale formats properly. v2: fix check for extra H.264 chroma formats [Haihao] Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
* decoder: h264: factor out allocation of reconstructed surfaces.Gwenole Beauchesne2014-06-021-11/+1
| | | | | | | | | | | | Add new avc_ensure_surface_bo() helper function to factor out the allocatiion and initialization processes of the reconstructed VA surface buffer stores. Keep preferred native format (NV12) and initialize chroma values to 0.0 (0x80) when needed for "fake" grayscale (Y800) surfaces implemented on top of existing NV12. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
* Use the VA_FOURCC_ABCD constant to replace the VA_FOURCC(A,B,C,D)Zhao Yakui2014-04-231-13/+13
| | | | | | | This is helpful to avoid the typo error when using VA_FOURCC(A, B, C, D). Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> (cherry picked from commit acea969011bceee36a57fe2c0e4ee96c0c5e79c7)