mm-video: vidc: Parse GOV start code for MPEG-4 VOPs

The first VOP in a GOV can start with a GOV start code
(0x000001B3) before regular VOP start code (0x000001B6).
In this case header parse function was throwing continuous
warning messages till all the start codes are processed.
With this change, GOV start code is also parsed for each VOP.
Log message priority is also lowered.

Change-Id: I7dfa34bc0e715af7b6026a827c2ad3c07e34ff80
CRs-fixed: 353381
(cherry picked from commit dd350aa1d020731333b01e920720909126b4b5be)
vidc: venc: Fix encoder input buffer logging

After adding support for metabuffer Encoder input
buffer logging failed because FD was passed as a
parameter to fwrite instead of buffer pointer.
Made changes to get the buffer pointer through mmap
and this is unmapped after fwrite.

CRs-Fixed: 341114
(cherry picked from commit b247efb2018067bbcde911b4c20f3fd9143c0c77)

Change-Id: I3a1aac777a3cff66ec23ff96c55d9c788c560b22
vidc: vdec: Do not flush frame parser if only SPS/PPS is queued.

If seek/flush occurs after sps/pps buffers given to video component,
the frameparser will be flushed and hence sps/pps are not sent to
the driver which is causing the decoding failures of subsequent
frames. This commit avoids the frame parser flush if codec header
buffers are not sent to the driver yet.

CRs-fixed: 353830
(cherry picked from commit 562c4976e8ba8c1d81d57225f06904bd0dd46d83)

Conflicts:

	vidc/vdec/inc/omx_vdec.h

Change-Id: I7e7c3e09e2f046ab0c6fc06245109b120c633db4
mm-video: vidc: Update TS entry removal logic for interlaced clips

Some of the interlaced clips have non-duplicate time stamps for
different fields/ETBs corresponding to a frame. Because of this,
time stamp parser table is getting full due to a problem in TS
entry removal. This commit takes care of this corner case and
removes next TS entry if a duplicate entry is not found for an
interlaced clip.

CRs-fixed: 356619
(cherry picked from commit 0386ad73b9c436d50a7ae21ed99cd65f18dd1d42)

Change-Id: Ic323025982bebcd1b383ce7fedfaafb317aa443c
vdec: Fix for free output buffers

As the ion device fd is closed in the memoryheapION
the ioctl for ION_IOC_FREE was failing, Moved the
free_ion_memory() before the memoryheapION destructor
is called.

(cherry picked from commit 3281f9a194635123e848f2b02d75e7092794ab66)

Change-Id: I13b01eb1baf0bed559532dc63d90ba063dbcb4f7
mm-video: vidc: Map Encoder input buffer aligned to 16

The video core requires the encoder input buffer size to be
calculated after aligning the height and width to 16.

CRs-Fixed: 369387
(cherry picked from commit e358d7e544ec6c369379d9eb27fdb3a1521a504d)

Change-Id: Ie8daf1648cb26fc08a11f9b110fe75f675d2a8ce
mm-video:vidc: set clks to turbo mode if slices are high in mpeg4

The firmware performance degrades when the number of slices in
decoded frames is more than 10. Without this fix, the clips with
high number of slices see frame drops causing freeze effect.
This change will affect only MPEG4 video, 1080p and above, in
non secure mode.

CRs-Fixed: 358615
Change-Id: Ia955813826d8d867323786e0fcf5584f2d6c4eb8
vidc: vdec: Amend timestamp reorder logic for interlaced content

Due to the wrong logic in duplicate timestamp reorder for interlaced
content, the output timestamps are not in ascending order sometimes.
This commit will fix the issue.

CRs-fixed: 374393
(cherry picked from commit 1a77a3ff3cdc5d49ba592f29db1c701e79d04fea)

Change-Id: Ibef7d96bdedcccd506fcf61e83044865add57438
mm_video: vidc: Align input buffer size for vdec

1080p video core needs scratch space in the input buffers.
This change will reduce the input buffer size exposed to client
by scratch buffer requirements of video core.

CRs-fixed: 366808
(cherry picked from commit 47e4a91c378f46031ff2a0cef64b6afa3a6b6944)

Change-Id: Ib00f50bf49e85054b9db0f72ae59589e7f2839d2
vidc: venc: Fix enumeration of color formats.

Video encoder component should return OMX_ErrorNoMore,
when nindex is greater than the color format enumeration
count.

Change-Id: Ib4654bfe76a91d5325d369d95bf51bd0467efd20
CRs-Fixed: 384335