1) Refactored RTMP code

2) Refactored PIpeline code
3) Refactored Utility Code
4) Added License header to missing files and new ones alike
5) Added include(header) guards in all .h files
6) Renamed many functions to standard names.
This commit is contained in:
Abhinav Bharti 2025-04-24 03:38:34 +01:00
parent 7f6e48f3bf
commit c90a3feab6
11 changed files with 1283 additions and 1116 deletions

View File

@ -7,8 +7,17 @@
* distribution, or modification of this file, via any medium, is strictly prohibited.
*
* For more information, visit: https://swatah.ai
*/
*/
#ifndef _SAIX_COMMON_DEFINES_H_
#define _SAIX_COMMON_DEFINES_H_
#include <stdint.h>
#define RKISP1_DEV_NAME "/dev/rkisp1"
#define RKISP2_DEV_NAME "/dev/rkisp2"
#define RKISP3_DEV_NAME "/dev/rkisp3"
#define RKISP4_DEV_NAME "/dev/rkisp4"
#define RKISP_MAINPATH 0
#define RKISP_SELFPATH 1
#define RKISP_FBCPATH 2
@ -33,4 +42,6 @@
#define RTSP_URL_2 "/live/2"
#define RTMP_URL_0 "rtmp://127.0.0.1:1935/live/mainstream"
#define RTMP_URL_1 "rtmp://127.0.0.1:1935/live/substream"
#define RTMP_URL_2 "rtmp://127.0.0.1:1935/live/thirdstream"
#define RTMP_URL_2 "rtmp://127.0.0.1:1935/live/thirdstream"
#endif /* _SAIX_COMMON_DEFINES_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2025 NeuralSense AI Private Limited
* Trading as swatah.ai. All rights reserved.
*
* This file is part of the swatah.ai software stack and is licensed under
* the terms defined in the accompanying LICENSE file. Unauthorized copying,
* distribution, or modification of this file, via any medium, is strictly prohibited.
*
* For more information, visit: https://swatah.ai
*/
#ifndef _SAIX_IPC_PIPELINE_H_
#define _SAIX_IPC_PIPELINE_H_
#include "rk_common.h"
#include <pthread.h>
extern int pipe_id_;
extern MPP_CHN_S vi_chn, venc_chn, ivs_chn;
extern int enable_npu, g_enable_vo;
extern const char *tmp_smart;
extern const char *tmp_gop_mode;
extern const char *tmp_rc_quality;
extern const char *tmp_output_data_type;
extern const char *tmp_rc_mode;
extern const char *tmp_h264_profile;
extern pthread_t saix_thread_venc0_handle;
extern pthread_t vi_thread_1, venc_thread_1, venc_thread_2, jpeg_venc_thread_id,
vpss_thread_rgb, cycle_snapshot_thread_id, get_nn_update_osd_thread_id,
get_vi_send_jpeg_thread_id, get_vi_2_send_thread, get_ivs_result_thread;
int saix_setup_pipeline0();
int saix_teardown_pipeline0();
int saix_setup_pipe1() ;
int saix_teardown_pipe1();
int saix_setup_ivs_pipe();
int saix_teardown_ivs_pipe();
int saix_setup_jpeg_pipe();
int saix_teardown_jpeg_pipe();
#endif /* _SAIX_IPC_PIPELINE_H_ */

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2025 NeuralSense AI Private Limited
* Trading as swatah.ai. All rights reserved.
*
* This file is part of the swatah.ai software stack and is licensed under
* the terms defined in the accompanying LICENSE file. Unauthorized copying,
* distribution, or modification of this file, via any medium, is strictly prohibited.
*
* For more information, visit: https://swatah.ai
*/
#include "saix_common_defines.h"
#include "saix_rtmp.h"
int saix_ipc_rtmp_init() {
int ret = 0;
ret |= rk_rtmp_init(0, RTMP_URL_0);
ret |= rk_rtmp_init(1, RTMP_URL_1);
// ret |= rk_rtmp_init(2, RTMP_URL_2);
return ret;
}
int saix_ipc_rtmp_deinit() {
int ret = 0;
ret |= rk_rtmp_deinit(0);
ret |= rk_rtmp_deinit(1);
// ret |= rk_rtmp_deinit(2);
return ret;
}

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2025 NeuralSense AI Private Limited
* Trading as swatah.ai. All rights reserved.
*
* This file is part of the swatah.ai software stack and is licensed under
* the terms defined in the accompanying LICENSE file. Unauthorized copying,
* distribution, or modification of this file, via any medium, is strictly prohibited.
*
* For more information, visit: https://swatah.ai
*/
#ifndef _SAIX_RTMP_H_
#define _SAIX_RTMP_H_
int saix_ipc_rtmp_init();
int saix_ipc_rtmp_deinit();
#endif /* _SAIX_RTMP_H_ */

View File

@ -7,7 +7,7 @@
* distribution, or modification of this file, via any medium, is strictly prohibited.
*
* For more information, visit: https://swatah.ai
*/
*/
#include "common.h"
#include "saix_common_defines.h"

View File

@ -1,4 +1,16 @@
/*
* Copyright (c) 2025 NeuralSense AI Private Limited
* Trading as swatah.ai. All rights reserved.
*
* This file is part of the swatah.ai software stack and is licensed under
* the terms defined in the accompanying LICENSE file. Unauthorized copying,
* distribution, or modification of this file, via any medium, is strictly prohibited.
*
* For more information, visit: https://swatah.ai
*/
#ifndef _SAIX_THREADS_H_
#define _SAIX_THREADS_H_
#include<rk_common.h>
@ -24,3 +36,5 @@ void *saix_push_vi2_to_iva(void *arg);
void *saix_get_vpss_bgr_frame(void *arg);
void *saix_fetch_ivs_results(void *arg);
void *saix_push_vi2_to_iva(void *arg);
#endif /* _SAIX_THREADS_H_ */

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2025 NeuralSense AI Private Limited
* Trading as swatah.ai. All rights reserved.
*
* This file is part of the swatah.ai software stack and is licensed under
* the terms defined in the accompanying LICENSE file. Unauthorized copying,
* distribution, or modification of this file, via any medium, is strictly prohibited.
*
* For more information, visit: https://swatah.ai
*/
#include "saix_utils.h"
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "saix_cutils"
int rga_nv12_border(rga_buffer_t buf, int x, int y, int width, int height, int line_pixel,
int color) {
im_rect rect_up = {x, y, width, line_pixel};
im_rect rect_buttom = {x, y + height - line_pixel, width, line_pixel};
im_rect rect_left = {x, y, line_pixel, height};
im_rect rect_right = {x + width - line_pixel, y, line_pixel, height};
IM_STATUS STATUS = imfill(buf, rect_up, color);
STATUS |= imfill(buf, rect_buttom, color);
STATUS |= imfill(buf, rect_left, color);
STATUS |= imfill(buf, rect_right, color);
return STATUS == IM_STATUS_SUCCESS ? 0 : 1;
}

View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2025 NeuralSense AI Private Limited
* Trading as swatah.ai. All rights reserved.
*
* This file is part of the swatah.ai software stack and is licensed under
* the terms defined in the accompanying LICENSE file. Unauthorized copying,
* distribution, or modification of this file, via any medium, is strictly prohibited.
*
* For more information, visit: https://swatah.ai
*/
#ifndef _SAIX_UTILS_H_
#define _SAIX_UTILS_H_
#include <rga/im2d.h>
int rga_nv12_border(rga_buffer_t buf, int x, int y, int width, int height, int line_pixel,
int color);
#endif /* _SAIX_UTILS_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,8 @@
* distribution, or modification of this file, via any medium, is strictly prohibited.
*
* For more information, visit: https://swatah.ai
*/
*/
#include "common.h"
#include "isp.h"
#include "osd.h"
@ -17,6 +18,7 @@
#include "rtmp.h"
#include "rtsp.h"
#include "storage.h"
#include <pthread.h>
#include <rga/im2d.h>
//#include <rga/rga.h>