video overlay를 지원하기위해 어떤 방법을 사용하시나요?
영상처리 관련해서 카메라를 통해 capture된 YUV영상을 app상에서 처리하실때 어떤방법을 쓰는것이 가장효과적일까요?
현재까지 저는 yuvoverlay를 지원해주는 툴이 x상에서 SDL만 있는줄 알았습니다. 그리고 여기 저기 질문을 올려도 SDL에 대해서 말씀하시더군요. 그런데 SDL은 실제 다른 드라이버 lib들을 추상화시켜서 멀티미디어 처리를 쉽게 할수 있도록 만든 라이브러리더군요. SDL을 불러서 YUV영상을 그리면 그 내부에서 별도로 window창을 만들어서 이게 복잡한 여러 상황(다른 윈도의 안에서 위치, 이동등등)에서는 융통성이 없어지고 또 직접 드라이버를 제어하는게 아니니까 사용하는 라이브러리만 더 많아지고 그렇더군요. 그렇다고 framebuffer 을 쓰려해도 xwindow상에서는 동작하지 않구요. 그러다가 xv Extension이라는 라이브러리를 발견하게 되었습니다. 많은 그래픽 벤더에 대한 지원이 있더군요.
이 xv라는게 x video의 약자인것 같은데 linux의 xfree86상에서 yuv영상데이터에 대한 overlay와 윈도우에서 말하는 video input port를 지원하는듯 하더군요.(이부분은 불확실?아시는 분 커멘트좀 달아주세요, 그동안 video input port지원에 대해 애타게 찾아돌아다녔었거든요.)
현재 간단한 샘플을 돌려봤는데 fps도 제가 생각하는 수준으로 나오는듯 하네요.
xv에 대한 글이 없는데 사용해보신분들의 경험담이나 설명등등을 듯고 싶습니다.
Xv ( 3X ) Name Xv ??X Window System video extension Description The Xv extension provides support for video adaptors attached to an X display. It takes the approach that a display may have one or more video adaptors, each of which has one or more ports though which independent video streams pass. An adaptor may be able to display video in a drawable, capture video from a drawable, or both. It translates between video encoding (NTSC, PAL, SECAM, etc...) and drawable format (depth and visual춊d pair). An adaptor may support multiple video encodings and/or multiple drawable formats. Clients use Xv(3X) to gain access and manage sharing of a display's video resources. Typically, a client will use XvQueryExtension(3X) to determine the status of the extension, XvQueryAdaptors(3X) to get a descrip? tion of what video adaptors exist, and XvQueryEncodings(3X) to get a description of what video encodings an adaptor supports. Once a client has determined what video resources are available, it is free to put video into a drawable or get video from a drawable, according the capabilities supported. Clients can select to receive events when video activity changes in a drawable and when port attributes have changed. Summary of Library Functions The following is a summary of Xv library functions: XvGetPortAttribute(3X) -- return current port attribute value XvGetStill(3X) -- capture a single frame of video from a drawable XvGetVideo(3X) -- capture video from a drawable XvGrabPort(3X) -- lock port for exclusive use by client XvPortNotify(3X) -- event generated when port attributes change XvPutStill(3X) -- write a single frame of video to a drawable XvPutVideo(3X) -- write video into a drawable XvQueryAdaptors(3X) -- return adaptor information for a screen XvQueryBestSize(3X) -- determine the optimum drawable region size XvQueryEncodings(3X) -- return list of encodings for an adaptor XvQueryExtension(3X) -- return version and revision of extension XvSelectPortNotify(3X) -- enable or disable XvPortNotify events XvSelectVideoNotify(3X) -- enable or disable XvVideoNotify events XvSetPortAttribute(3X) -- set an attribute for a port XvStopVideo(3X) -- stop active video XvUngrabPort(3X) -- release a grabbed port 출처: xv protocol v2
http://www.cs.uni-potsdam.de/~wertmann/xv/testxv.c 여기에 샘플 소스가 있습니다. 컴팔시에 -lXv -lXext
framebuffer로 xwindow에서도 됩니다..사실 SDL
framebuffer로 xwindow에서도 됩니다..
사실 SDL 도 프레임(layer) 생성이 가능하기 때문에 overlay가 가능합니다만.. 보통 SDL을 쓰게 될경우는 거의 VESA 모드로 동작을 원하는 경우가 많습니다.. (임베디드 계열이죠.. 단, 속도가 느림)
xv는 VGA 가속기능을 위해 실제 카드 드라이버를 Xfree86에서 포팅하여 이용하기 때문에 상당히 빠릅니다.. xwindow 환경이므로 xwindow 자체가 각 창들이 프레임 형태로(layer) 만들어 지기 때문에 오버레이 같은 효과를 줄수도 있구요.. 기본 Layer 위에 다른 Layer를 올려 주는 겁니다... 보통 영화 볼때나 리모콘등등의 제어 상황을 보여줄때 많이 이용합니다. 이와 비슷한것으로 DGA 도 있구요..
xv의 경우 yuv2rgb 식으로 변환필요 없이 직접 뿌려 주기 때문에 좀더 빠른것이라 생각도 됩니다....
이와 관련한 자료는 mplayer 소스를 보면 아주 자세하게 나와 있습니다...
SDL 인터페이스는 smpeg 이란 소스가 쉬워서 보기 좋구요...
저역시 이쪽 작업을 위해 smpeg 소스를 분석해서 작업을 한적이 있습니다..
smpeg + SDL + VESA 모드 였는데 생각 만큼 잘 나오더군요..
단, 속도가 느리고, double buffering 의 압박.............. T.T
=================================
:: how about a cup of tea ? ::
=================================
댓글 달기