is there a specific place where add_filter must be placed?

add_filter() and add_action() are available before any plugin is loaded. So you can use both in the first line of your plugin or theme.

For readability I recommend to group action and filter registrations at the very top of your main file:

in a plugin, the file with the plugin header
in a theme the functions.php
There are exceptions for that rule:

Chained callbacks. In this example I register an action for shutdown only when the first filter for wp_nav_menu_objects has been called. So the second callback cannot be registered at the same time as the first one.

to conclude it is possible to a certain point but it’s not recommanded