Top Banner
1 Application Note Video Input of MB86291 © Fujitsu Microelectronics Europe GmbH History 25 th April. 01 MM V1.0 First version
9

Application Note Video Input of MB86291

Sep 12, 2021

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Application Note Video Input of MB86291

1

Application Note

Video Input of MB86291© Fujitsu Microelectronics Europe GmbH

History25th April. 01 MM V1.0 First version

Page 2: Application Note Video Input of MB86291

2

Warranty and Disclaimer

To the maximum extent permitted by applicable law, Fujitsu Mikroelektronik GmbH restricts itswarranties and its liability for all products delivered free of charge (eg. software include or headerfiles, application examples, application Notes, target boards, evaluation boards, engineering samplesof IC’s etc.), its performance and any consequential damages, on the use of the Product inaccordance with (i) the terms of the License Agreement and the Sale and Purchase Agreement underwhich agreements the Product has been delivered, (ii) the technical descriptions and (iii) allaccompanying written materials. In addition, to the maximum extent permitted by applicable law,Fujitsu Mikroelektronik GmbH disclaims all warranties and liabilities for the performance of the Productand any consequential damages in cases of unauthorised decompiling and/or reverse engineeringand/or disassembling. Note, all these products are intended and must only be used in anevaluation laboratory environment.

1. Fujitsu Mikroelektronik GmbH warrants that the Product will perform substantially inaccordance with the accompanying written materials for a period of 90 days form the date ofreceipt by the customer. Concerning the hardware components of the Product, FujitsuMikroelektronik GmbH warrants that the Product will be free from defects in material andworkmanship under use and service as specified in the accompanying written materials for aduration of 1 year from the date of receipt by the customer.

2. Should a Product turn out to be defect, Fujitsu Mikroelektronik GmbH´s entire liability and thecustomer´s exclusive remedy shall be, at Fujitsu Mikroelektronik GmbH´s sole discretion,either return of the purchase price and the license fee, or replacement of the Product or partsthereof, if the Product is returned to Fujitsu Mikroelektronik GmbH in original packing andwithout further defects resulting from the customer´s use or the transport. However, thiswarranty is excluded if the defect has resulted from an accident not attributable to FujitsuMikroelektronik GmbH, or abuse or misapplication attributable to the customer or any otherthird party not relating to Fujitsu Mikroelektronik GmbH.

3. To the maximum extent permitted by applicable law Fujitsu Mikroelektronik GmbH disclaims allother warranties, whether expressed or implied, in particular, but not limited to, warranties ofmerchantability and fitness for a particular purpose for which the Product is not designated.

4. To the maximum extent permitted by applicable law, Fujitsu Mikroelektronik GmbH´s and itssuppliers´ liability is restricted to intention and gross negligence.

NO LIABILITY FOR CONSEQUENTIAL DAMAGES

To the maximum extent permitted by applicable law, in no event shall FujitsuMikroelektronik GmbH and its suppliers be liable for any damages whatsoever(including but without limitation, consequential and/or indirect damages for personalinjury, assets of substantial value, loss of profits, interruption of business operation,loss of information, or any other monetary or pecuniary loss) arising from the use of theProduct.

Should one of the above stipulations be or become invalid and/or unenforceable, the remainingstipulations shall stay in full effect.

Page 3: Application Note Video Input of MB86291

3

1. Overview

The video capture unit of MB86291 works as shown in figure below :

VerticalInterpolator

CaptureBufferController

DisplayController

Internal bus for

Scaler

graphics memory access

Buffer address

Clip range

RatioOn / Off

Position & size of

VideoInput

VideoOutput

Graphics Memory

Capture Buffer

Other Image

W-layer

MB86291

Sync

The video input stream corresponds to the „CCIR International Radio Consultative CommitteeRecommendation 656 – Interfaces for digital component video signals in 525-line and 625-linetelevision systems“.

The vertical interpolater is used for non-interlace convertion in BOB mode and adds rastersbetween even or odd field. The algorithm which is used is :

Generation of even rasters for odd fields : pix[x,2n] = (pix[x,2n-1]+pix[x,2n+1])/2 (n=1,2,3, ... ) Generation of odd rasters for even fields : pix[x,1] = pix[x,2];

pix[x,2n-1] = (pix[x,2n]+pix[x,2+1])/2 (n=2,3,4, ... )

The scaler unit shrinks input image with given ratio. Bi-linear interplation is used for rationalimage shrink.

The capture buffer controller stores image data into graphics memory after clipping. A circularbuffer management is applied for writing data into the capture buffer. Image data is stored inYCbCr format in graphics memory in this format :

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0Y0 Cb

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16Y1 Cr

The display controller reads image data in video capture synchronously with capture operation anddisplays it on screen as W-layer with other layers. Non-interlace conversion in WEAVE mode isapplied by display controller. Scarlet supporses that YCbCr data is converted from RGB by followingequations :R' = (219/256)R+16, G'= (219/256)G+16, B'= (219/256)B+16�Y = (77/256)R'+(150/256)G'+(29/256)B'Cr = (131/256)R'-(110/256)G'-(21/256)B'+128Cb = -(44/256)R'-(87/256)G' +(131/256)B'+128

The inverse conversion of this is used for YCbCr data to display output.

Page 4: Application Note Video Input of MB86291

4

2. Modes of non-interlace convertion

If an interlaced video stream is given as input :

odd fields are transferred in the first 1/60 second and even fields are transferred in the next 1/60second, so half number of rasters are included in each field. Note that 1/60 second is taken forone field in NTSC while 1/50 second is taken in PAL.

There are two modes of non-interlace convertion or BOB mode and WEAVE mode.

Page 5: Application Note Video Input of MB86291

5

(1) BOB mode

In BOB mode, odd fields are converted into a frame with interpolated rasters in 1/60 second. Evenfields are converted in the next frame with interpolated rasters in 1/60 second. This operation isdone by the vertical interpolator :

Page 6: Application Note Video Input of MB86291

6

(2) WEAVE mode

In weave mode, a frame is reconstructed from both the odd fields and even fields every 1/30second and is displayed twice on screen in non-interlaced scanning in 1/30 second. This operationis done by the display controller. The vertical interpolator is not used for WEAVE mode.

NOTE : The WEAVE mode is the appropriate mode for still pictures since the picture quality ishigher compared to the BOB mode. Moving pictures in WEAVE mode will have some distortionsdue to the frame reconstruction from different fields. For moving pictures, the BOB mode is moreappriopriate.

Page 7: Application Note Video Input of MB86291

7

3. Applied parameters

The following parameters are applied during scaler operation : (See explanations on next page)

Page 8: Application Note Video Input of MB86291

8

The original picture size is Wa, Ha. The size after scaling should be Wb, Hb.

(1) Scaler parameters

The scaler shrinks input image with given ratios defined by HSC / HSCF / VSCI / VSCF registers.The input image size is defined by input data stream since input data stream includes HSYNC andVSYNC code.Note : In BOB mode, only one field is passed to the scaler unit. This means if the input image is an720*480 pixel interlaced frame, the parameters are : Ha = 480 in BOB mode, Ha = 240 in WEAVEmode and Wa = 720 in both modes.The reduction scale is set by 5bit integer and 11bit fraction values for horizontal and verticaldirection. So a setting of VSC=1.0 and HSC=1.0 would be represented by a value of 08000800H inthe CSC register. Valid settings for VSC and HSC are from 0800H to FFFFH. No enlargement canbe set ! Set the vertical direction at bits 31 to 16 of the capture scale register (CSC) and thehorizontal direction at bits 15 to 00. An example of the expressions for setting a reduction in thevertical and horizontal directions is shown below.Reduction in vertical direction 576à 490 lines 576/490 = 1.1761.176 x 2048=2408à 0968H

Reduction in horizontal direction 720 à 648 pixels 720/648 = 1.1111.111 x 2048=2275 à 08E3H

Therefore, 096808E3H is set in CSC.

(2) Capture buffer controllerFrom the scaled image, a rectangular area is clipped out before the final picture is written to

the memory. The cature buffer controller applies clip range defied by CIHSTR/ CIVSTR /CIHEND / CIVEND registers and stores data into capture buffer area in graphics memorydefined by CBOA / CBLA / CBW registers. Capture buffer is managed as ring buffer (if read orwrite pointer location crosses the limit, it returns to the origin).

(3) Display controllerThe display controller displays image data in capture buffer as W-layer with other layes. It

follows latest available frame in capture buffer. In WEAVE, the display controller reconstructs aframe from odd field and even field stored in capture buffer. In WEAVE mode, a buffer size of2.2 frames is the minimum, a safe recommendation is a 2.5 frame buffer.

Page 9: Application Note Video Input of MB86291

9

Page 10: Application Note Video Input of MB86291

MB86291 SCARLETGraphics Controller 8Video Capture

4. Frame SynchronizationThe capture buffer controller sequencially writes captured rasters into the buffer while the display

controller tries to display latest completed frame. Resulting behaviors under different conditions are shown

bellow to optimize buffer size. If a reader doesn’t care about optimization of size, this description can be

ignored.

(1) Capture is faster than display in BOB mode

1 2 43 5 6 7 98 10

1 2 3 4 6 7 8 9 11

11 12 13

12 13

time difference to be absorbed on the buffer

time

Capture

Display

frameskip

field

display

capture

5

4

6

5

4

6

display

6

(capture)

capture

wrap around

margin

Snapshot of buffer status

buffer size

2.2−2.5 frames

stride

CBOA

CBLA

pointer

pointer

pointer

pointer

Under this condition, it is the worst case when frame skip occurs. The display pointer runs from begin

of frame-4 and reaches end of it while the capture pointer runs from begin of frame-6 and reaches end of

it. The capture buffer controller overwrites frame-4 in that time. It is need to allocate enough margin to

avoid buffer overrun.

td < tc+ tm

td : time to display a frame

tc : time to capture a field

tm : time for capture to write into margin

Minimun buffer size is 2 frame + margin size where margine size is calculated from tm.

If capture field rate is 60 field/sec and display frame rate is 50 frame/sec, 1/50−1/60 < tm should be

satisfied. Number of rasters captured in tm is margin size.

Page 11: Application Note Video Input of MB86291

MB86291 SCARLETGraphics Controller 9Video Capture

(2) Capture is slower than display in BOB mode

1 2 3 4 5 6 98 10

1 2 3 4 4 5 6 9

11 12

10 11

time difference to be absorbed on the buffer

time

Capture

Display

field

frame

7

7 8 8

repeat

(3) Capture is fatser than display in WEAVE mode

1(o,e)

1 1 2 3 3 4 5 5 6 6

time difference to be absorbed on the buffer

time

Capture

Display

frameskip

odd field

2(o,e) 3(o,e) 4(o,e) 5(o,e) 6(o,e) 7(o,e) 8(o,e)

even field

(4) Capture is slower than display in WEAVE mode

1 1 2 2 2 3 4

time difference to be absorbed on the buffer

time

Capture

Display

field

frame

3 4 4

repeat

1(o,e) 2(o,e) 3(o,e) 4(o,e) 5(o,e) 6(o,e)

5 5 6

Page 12: Application Note Video Input of MB86291

MB86291 SCARLETGraphics Controller 10Video Capture

5. Parameter decision process

Assume that an user captures an image locating at (xs,ys) and it’s size is ws∗hs. It should be

displayed in a window that size is wd*hd. Here wd is even number because of hardware limitation.

(1) Decide de-interlace mode

The user decides which mode of de-interlace is used by comaring input image format and size of

output window.

n = number of rasters per field

n ≥ hd : de-interlace is not need

n < hd ≤ 2n : BOB or WEAVE

If de-interlace is not used, odd field and even field are displayed alternatively at same position but

it is enough for relatively small size window display.

(2) Decide shrink ratio

rh = ws/wd

rv = hs/hd

Integer part of ratios are set into HSCI and VSCI respectively while fraction part of ratios are set

into HSCF and VSCF respectively

HSCI∗2048+HSCF = floor(rh∗2048+0.5)

VSCI∗2048+VSCF = floor(rv∗2048+0.5)

Factor 2048 at left hand represents bit position of integer part.

Floor means round down to nearest integer ( i.e. ANSI-C function)

(3) Decide clip range to be stored in capture buffer

CIHSTR = floor(xs/rh+0.5)

CIVSTR = floor(ys/rv+0.5) for not WEAVE mode

= floor(ys/rv/2+0.5) for WEAVE mode

CIHEND = CIHSTR+ wd −1

CIVEND = CIVSTR+hd−1 for not WEAVE mode

= CIVSTR+hd/2−1 for WEAVE mode

(4) Decide stride of capture buffer and W-layer

CBW = WW= ceil( wd/32)

Ceil means round up to nearest integer ( i.e. ANSI-C function)

(5) Decide buffer limit

CBLA = CBOA + ceil(K∗hd)∗CBW*64

Page 13: Application Note Video Input of MB86291

MB86291 SCARLETGraphics Controller 11Video Capture

Here K is factor that indicates buffer size by frame size. This value is ranged from 2.2 to 2.5.

K=2.2 is practical and K=2.5 is safe.

(6) Decide W-layer parameter

WW = xd

WH = yd−1