Skip to content

Commit 8e6a171

Browse files
committed
lib: vc8000nanoe: add trace support
Add debug trace support. Signed-off-by: Hugues Fruchet <[email protected]>
1 parent 90ee86d commit 8e6a171

File tree

5 files changed

+81
-0
lines changed

5 files changed

+81
-0
lines changed

lib/vc8000nanoe/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0
44
zephyr_library()
55

6+
zephyr_library_compile_definitions(H1_HAVE_ENCDEBUG_H)
67
zephyr_include_directories(inc)
78
zephyr_include_directories(source/common)
89
zephyr_include_directories(source/h264)

lib/vc8000nanoe/README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,9 @@ Patch List:
8080

8181
* Avoid MIN/MAX redefinition
8282
Impacted files: inc/enccommon.h
83+
84+
* Add assert/debug/trace support
85+
Impacted files: CMakeLists.txt
86+
inc/encdebug.h
87+
source/h264/H264EncApi.c
88+
source/h264/H264Init.c

lib/vc8000nanoe/inc/encdebug.h

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright (c) 2025 Hugues Fruchet <[email protected]>
3+
*
4+
********************************************************************************
5+
*
6+
* This software is distributed under the terms of
7+
* BSD-3-Clause. The following provisions apply :
8+
*
9+
********************************************************************************
10+
*
11+
* Redistribution and use in source and binary forms, with or without
12+
* modification, are permitted provided that the following conditions are met:
13+
*
14+
* 1. Redistributions of source code must retain the above copyright notice, this
15+
* list of conditions and the following disclaimer.
16+
*
17+
* 2. Redistributions in binary form must reproduce the above copyright notice,
18+
* this list of conditions and the following disclaimer in the documentation
19+
* and/or other materials provided with the distribution.
20+
*
21+
* 3. Neither the name of the copyright holder nor the names of its contributors
22+
* may be used to endorse or promote products derived from this software without
23+
* specific prior written permission.
24+
*
25+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35+
*
36+
********************************************************************************
37+
*
38+
* Description : Encoder debug definitions
39+
*
40+
********************************************************************************
41+
*/
42+
43+
#ifndef __ENC_DEBUG_H__
44+
#define __ENC_DEBUG_H__
45+
46+
#define CONFIG_ASSERT
47+
#define CONFIG_ASSERT_LEVEL 2
48+
49+
#include <zephyr/kernel.h>
50+
51+
#ifdef CONFIG_VENC_DEBUG
52+
#define ASSERT(expr) __ASSERT_NO_MSG(expr)
53+
#define DEBUG_PRINT(args) printf(args);printf("\n");
54+
#define COMMENT(x) printf(x);printf("\n");
55+
#define TRACE_BIT_STREAM(v,n)
56+
#define APITRACE(x) printf(x);printf("\n");
57+
#define APITRACEPARAM(x,y) printf(" %s: %d\n",x,y);
58+
#else
59+
#define ASSERT(expr) __ASSERT_NO_MSG(expr)
60+
#define DEBUG_PRINT(args)
61+
#define COMMENT(x)
62+
#define TRACE_BIT_STREAM(v,n)
63+
#define APITRACE(x)
64+
#define APITRACEPARAM(x,y)
65+
#define APITRACEPARAMX(x,y)
66+
#endif
67+
68+
#endif

lib/vc8000nanoe/source/h264/H264EncApi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,13 @@
115115
#define APITRACEPARAM(str, val) \
116116
{ char tmpstr[255]; sprintf(tmpstr, " %s: %d", str, (int)val); H264EncTrace(tmpstr); }
117117
#else
118+
#ifndef APITRACE
118119
#define APITRACE(str)
120+
#endif
121+
#ifndef APITRACEPARAM
119122
#define APITRACEPARAM(str, val)
120123
#endif
124+
#endif
121125

122126
/*------------------------------------------------------------------------------
123127
4. Local function prototypes

lib/vc8000nanoe/source/h264/H264Init.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@
7676
#ifdef H264ENC_TRACE
7777
#define APITRACE(str) H264EncTrace(str)
7878
#else
79+
#ifndef APITRACE
7980
#define APITRACE(str)
8081
#endif
82+
#endif
8183

8284
/*------------------------------------------------------------------------------
8385
4. Local function prototypes

0 commit comments

Comments
 (0)