Go to advanced search

by cmisip
Wed Jul 18, 2018 12:39 pm
Forum: Advanced users
Topic: The mmal example programs in github won't call the output callback
Replies: 10
Views: 1046

Re: The mmal example programs in github won't call the output callback

Thanks. example_basic_1.c now works when I adjusted the resolution to the video resolution. I am using 640x360 video resolution and notice the output of the decoder at 640x368. It seems that it will automatically adjust the frame size to the next multiple of 32 for x and 16 for y. Does that mean I d...
by cmisip
Tue Jul 17, 2018 12:06 am
Forum: Advanced users
Topic: The mmal example programs in github won't call the output callback
Replies: 10
Views: 1046

Re: The mmal example programs in github won't call the output callback

I stripped the audio with :

Code: Select all

ffmpeg -i abc.mp4 -vcodec copy -bsf h264_mp4toannexb -an -f h264 out.h264
And now example_basic_2.c works and is retrieving decoded frames. However, example_basic_1.c hangs, showing a bunch of "sending 1920 bytes" but no decoded frames returned.

Thanks,
Chris
by cmisip
Mon Jul 16, 2018 12:25 am
Forum: Advanced users
Topic: The mmal example programs in github won't call the output callback
Replies: 10
Views: 1046

Re: The mmal example programs in github won't call the output callback

I'm feeding it a video file in h264 format. It was taken from an rtsp h264 stream via ffmpeg with the following command.

Code: Select all

ffmpeg -i rtsp://mysv3c.chris.net/12  -acodec aac -vcodec copy  abc.mp4
Thanks,
Chris
by cmisip
Sun Jul 15, 2018 6:28 pm
Forum: Advanced users
Topic: The mmal example programs in github won't call the output callback
Replies: 10
Views: 1046

The mmal example programs in github won't call the output callback

The basic examples here (example_basic_1.c and example_basic_2.c):

https://github.com/raspberrypi/userland ... t/examples

only call the output callback when the program terminates. What am I missing?

Thanks
Chris
by cmisip
Fri Jul 13, 2018 11:13 am
Forum: Advanced users
Topic: Is there a performance penalty to using two byte structs instead of 4?
Replies: 16
Views: 1640

Re: Is there a performance penalty to using two byte structs instead of 4?

I got the clumsy data structure working and I haven't seen any alignment traps after running for a few days. There are two processess sending information via mmap. One is the capture daemon that is sending vector data and the other is the analysis daemon which is checking to see if the vectors are i...
by cmisip
Fri Jul 13, 2018 2:17 am
Forum: Advanced users
Topic: Just making sure I understand the mmal macroblock system.
Replies: 6
Views: 906

Re: Just making sure I understand the mmal macroblock system.

I wonder if this has something to do with the issue I am having. A frame that has resolution of 704x480 when converted to jpeg from RGB shows horizontal green lines on the Right side from top to bottom. If the frame size was 640x360, it encodes to jpeg fine without any artifacts. I do notice that fo...
by cmisip
Tue Jul 10, 2018 12:56 am
Forum: Advanced users
Topic: Is there a performance penalty to using two byte structs instead of 4?
Replies: 16
Views: 1640

Re: Is there a performance penalty to using two byte structs instead of 4?

I am actually at that point. I made sure to make the optimizations in a different branch. The program I am working on has a performance bottleneck and the raspberry has limited memory. I am trying to solve both issues but I did think more than twice about making the code more complex in order to gai...
by cmisip
Tue Jul 10, 2018 12:17 am
Forum: Advanced users
Topic: Is there a performance penalty to using two byte structs instead of 4?
Replies: 16
Views: 1640

Re: Is there a performance penalty to using two byte structs instead of 4?

I will be using memcpy to load values into a buffer and read from it. I therefore need to create a buffer of uint32_t* to be assured that I am given an address that is 4 byte aligned. Instead of saving a 4 byte word and using bit operations, use a struct with 4 members that are one byte size. In the...
by cmisip
Mon Jul 09, 2018 11:16 am
Forum: Advanced users
Topic: Is there a performance penalty to using two byte structs instead of 4?
Replies: 16
Views: 1640

Re: Is there a performance penalty to using two byte structs instead of 4?

I need to save memory for a program that I am working on. It deals with a series of int8_t value pairs. If I put two of these pairs in a struct ( the pairs are unrelated and really should be dealt with individually in a loop iteration) , so that the struct is 4 bytes long, would that still incur a p...
by cmisip
Mon Jul 09, 2018 1:49 am
Forum: Advanced users
Topic: Is there a performance penalty to using two byte structs instead of 4?
Replies: 16
Views: 1640

Is there a performance penalty to using two byte structs instead of 4?

I can save memory by using 2 byte structs but I don't know if I am giving up performance and speed by doing so because the arm cpu is 32 bit.

Thanks,
Chris
by cmisip
Fri Jul 06, 2018 11:26 am
Forum: Advanced users
Topic: Just making sure I understand the mmal macroblock system.
Replies: 6
Views: 906

Re: Just making sure I understand the mmal macroblock system.

Thanks for the replies.

What is the use of the extra column? If I calculate coordinates as the top left of the macroblock, the last column's coordinates would be past the size of the frame.

Thanks,
Chris
by cmisip
Thu Jul 05, 2018 8:28 pm
Forum: Advanced users
Topic: Just making sure I understand the mmal macroblock system.
Replies: 6
Views: 906

Re: Just making sure I understand the mmal macroblock system.

I am using it on ZoneMinder to see if motion vectors could be used as alternative means for detecting motion. Right now they use pixel analysis. Don't know if motion vector analysis will ever be practical. I am trying to ferret out alignment trap errors so I am making sure that I have not made wrong...
by cmisip
Wed Jul 04, 2018 9:01 pm
Forum: Advanced users
Topic: Just making sure I understand the mmal macroblock system.
Replies: 6
Views: 906

Just making sure I understand the mmal macroblock system.

For a specific resolution such as 704x480, there would be ( 704+16 )/16 = 45 tiles in a horizontal row and 480/16 = 30 rows. So to see if motion did happen in a macroblock, I just need to check if the absolute value of the x_vector and absolute value of the y_vector is greater than zero. If its grea...
by cmisip
Tue Aug 08, 2017 11:42 pm
Forum: C/C++
Topic: Trying to replace ffmpeg swscale. Is there anything wrong with this code.
Replies: 0
Views: 643

Trying to replace ffmpeg swscale. Is there anything wrong with this code.

I get the proper buffer format from vc.ril.isp and I can stream the data in jpeg format with a timestamp. However, the timestamps are erratic, jumping forward and backward. If I use swscale, there is no problem. I wonder if there is something that I initialized wrong. Utility functions: void FfmpegC...
by cmisip
Tue Aug 08, 2017 4:26 pm
Forum: C/C++
Topic: MMAL Splitter comp with H264 Cam for hardware rgb encode
Replies: 4
Views: 1712

Re: MMAL Splitter comp with H264 Cam for hardware rgb encode

I guess for anyone going down this road, there is vc.ril.isp which is a component that does resizing as well but with support for RGBA, RGB24 and I420 format conversion. That's what I ended up using.

Chris
by cmisip
Sun Jul 30, 2017 2:17 am
Forum: C/C++
Topic: MMAL Splitter comp with H264 Cam for hardware rgb encode
Replies: 4
Views: 1712

Re: MMAL Splitter comp with H264 Cam for hardware rgb encode

I cant seem to get the pipeline working form MMAL_ENCODING_RGB24 or MMAL_ENCODING_BGR24. It works for MMAL_ENCODING_RGBA. MMAL_COMPONENT_T *resizer = 0; MMAL_ES_FORMAT_T *format; MMAL_PORT_T *input_port = NULL, *output_port = NULL; MMAL_POOL_T *pool_rin = 0, *pool_rout = 0; //create the camera compo...
by cmisip
Wed Jul 26, 2017 11:18 am
Forum: Bare metal, Assembly language
Topic: Optimizing code for 64 byte cache line
Replies: 2
Views: 1034

Optimizing code for 64 byte cache line

Is there any benefit to aligning data bytes to 64 bytes in the rasberry pi 3? This is running raspbian. if(((unsigned long)shared_mbuff % 64) != 0) { // Align images buffer to nearest 64 byte boundary Debug(3,"Aligning shared memory buffer to the next 64 byte boundary"); shared_mbuff = (uint8_t*)((u...
by cmisip
Mon Jul 24, 2017 11:24 am
Forum: C/C++
Topic: MMAL Splitter comp with H264 Cam for hardware rgb encode
Replies: 4
Views: 1712

Re: MMAL Splitter comp with H264 Cam for hardware rgb encode

I think both the resizer and the splitter can do format conversions from yuv to rgb or gray. In that case, If I want to replace ffmpeg's swscale routine which does both scaling and format conversion, all I need is the resizer? I want to try to minimize cpu overhead and gpu memory as much as possible...
by cmisip
Sun Jul 23, 2017 1:22 pm
Forum: C/C++
Topic: MMAL Splitter comp with H264 Cam for hardware rgb encode
Replies: 4
Views: 1712

MMAL Splitter comp with H264 Cam for hardware rgb encode

I was looking over raspivid source and if I understand things correctly, a splitter component can be created to perform format conversions. I have an h264 camera being decoded in hardware and feeding YUV420 buffers to the h264 encoder. I am thinking that I could create a splitter component and feed ...
by cmisip
Sat Jul 15, 2017 9:40 pm
Forum: Camera board
Topic: H 264 Motion Detection - Compressed Domain
Replies: 60
Views: 30591

Re: H 264 Motion Detection - Compressed Domain

Now I have 5 cameras at 640x360 running hardware decode and encode. I don't dare add another one because It might start swapping. Load : load average: 1.59, 1.69, 1.98 Memory utilization is at : KiB Mem: 766876 total, 718944 used, 47932 free, 31084 buffers KiB Swap: 102396 total, 40036 used, 62360 f...
by cmisip
Sat Jul 15, 2017 9:01 pm
Forum: Camera board
Topic: H 264 Motion Detection - Compressed Domain
Replies: 60
Views: 30591

Re: H 264 Motion Detection - Compressed Domain

I have been trying different combinations and was successfully able to activate 4 cameras at 704x480 using hardware decode and encode after I adjusted the gpu memory to 256. It is a balancing act as at this resolution, zmc and zma consume 10-13% memory each which only leaves less than 20% for other ...
by cmisip
Thu Jul 13, 2017 12:31 am
Forum: Camera board
Topic: H 264 Motion Detection - Compressed Domain
Replies: 60
Views: 30591

Re: H 264 Motion Detection - Compressed Domain

@6by9 Good to hear from you again. For some reason, I can only use the hardware decoder and encoder on three cameras. If I try the fourth camera, I get errors. I am using 640x360x24 right now. So that yields 124416000 / 5529600 or 22 streams. If I count each encode and decode separately, thats just ...
by cmisip
Tue Jul 11, 2017 11:25 pm
Forum: Camera board
Topic: H 264 Motion Detection - Compressed Domain
Replies: 60
Views: 30591

Re: H 264 Motion Detection - Compressed Domain

I managed to get the code up and running on a fork of ZoneMinder. The code is on github: https://github.com/cmisip/ZoneMinder Thanks especially for 6by9's insights, who seem to have decided not to talk to me anymore... in this thread. Perhaps I should have started a new thread. :) Looking forward to...
by cmisip
Sat Jul 08, 2017 10:55 pm
Forum: Camera board
Topic: H 264 Motion Detection - Compressed Domain
Replies: 60
Views: 30591

Re: H 264 Motion Detection - Compressed Domain

Well I did confirm that it works by overlaying the motion vectors on video. I was able to coordinate sending YUV420 data and receiving motion vectors for each particular frame. The way I did it was to send an EOS to the encoder after I get the side info buffer. The encoder responded with an EOS. I j...
by cmisip
Mon Jul 03, 2017 1:14 am
Forum: Camera board
Topic: H 264 Motion Detection - Compressed Domain
Replies: 60
Views: 30591

Re: H 264 Motion Detection - Compressed Domain

I think my assumption was pretty near accurate. The video frame is tiled by 16x16 macroblocks left to right and then from top to down row by row with the extra column spilling out of the right side. I just needed a bit more imagination to recognize the moving shapes in front of the camera. I couldn'...

Go to advanced search